From 7a6fe0cda0a1089c1c82fdd5f7f2db940f70feae Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 12 Feb 2019 16:16:12 -0800 Subject: [PATCH] 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 --- React/Views/RCTBorderDrawing.m | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/React/Views/RCTBorderDrawing.m b/React/Views/RCTBorderDrawing.m index 2a8d105471aa2a..a92db47791018d 100644 --- a/React/Views/RCTBorderDrawing.m +++ b/React/Views/RCTBorderDrawing.m @@ -224,13 +224,15 @@ static CGContextRef RCTUIGraphicsBeginImageContext(CGSize size, CGColorRef backg 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