Fix triangle views on iOS (#23402)

Summary:
Fixes #22824 #21945 , the bug comes from #21208 , it was to fix #11897. Now Let's constrain edge adjust only when view has corners.

[iOS] [Fixed] - Fix triangle views on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/23402

Differential Revision: D14059192

Pulled By: hramos

fbshipit-source-id: be613bf056d3cc484f281f7ea3d08f251971700a
This commit is contained in:
zhongwuzw
2019-02-12 16:16:12 -08:00
committed by Facebook Github Bot
parent 05c56edf41
commit 7a6fe0cda0

View File

@@ -224,13 +224,15 @@ static UIImage *RCTGetSolidBorderImage(RCTCornerRadii cornerRadii,
borderInsets.right + MAX(cornerInsets.bottomRight.width, cornerInsets.topRight.width)
};
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
edgeInsets = (UIEdgeInsets){
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
};
if (hasCornerRadii) {
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
edgeInsets = (UIEdgeInsets){
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
MAX(edgeInsets.top, edgeInsets.bottom),
MAX(edgeInsets.left, edgeInsets.right),
};
}
const CGSize size = makeStretchable ? (CGSize){
// 1pt for the middle stretchable area along each axis