Skip to content

Commit 7a6fe0c

Browse files
zhongwuzwfacebook-github-bot
authored andcommitted
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: #23402 Differential Revision: D14059192 Pulled By: hramos fbshipit-source-id: be613bf056d3cc484f281f7ea3d08f251971700a
1 parent 05c56ed commit 7a6fe0c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

React/Views/RCTBorderDrawing.m

+9-7
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ static CGContextRef RCTUIGraphicsBeginImageContext(CGSize size, CGColorRef backg
224224
borderInsets.right + MAX(cornerInsets.bottomRight.width, cornerInsets.topRight.width)
225225
};
226226

227-
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
228-
edgeInsets = (UIEdgeInsets){
229-
MAX(edgeInsets.top, edgeInsets.bottom),
230-
MAX(edgeInsets.left, edgeInsets.right),
231-
MAX(edgeInsets.top, edgeInsets.bottom),
232-
MAX(edgeInsets.left, edgeInsets.right),
233-
};
227+
if (hasCornerRadii) {
228+
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
229+
edgeInsets = (UIEdgeInsets){
230+
MAX(edgeInsets.top, edgeInsets.bottom),
231+
MAX(edgeInsets.left, edgeInsets.right),
232+
MAX(edgeInsets.top, edgeInsets.bottom),
233+
MAX(edgeInsets.left, edgeInsets.right),
234+
};
235+
}
234236

235237
const CGSize size = makeStretchable ? (CGSize){
236238
// 1pt for the middle stretchable area along each axis

0 commit comments

Comments
 (0)