Skip to content

Commit

Permalink
Fix triangle views on iOS (#23402)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zhongwuzw authored and grabbou committed Apr 8, 2019
1 parent 05723ed commit 0167cf2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions React/Views/RCTBorderDrawing.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0167cf2

Please sign in to comment.