mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Fixed fractional border width on iOS
Summary: Incorrect render for borders that are not proportional to device pixel: borders get stretched and become significantly bigger than expected. Rdar: http://www.openradar.me/15959788 Incorrect render for borders that are not proportional to device pixel: borders get stretched and become significantly bigger than expected. Rdar: http://www.openradar.me/15959788 Reviewed By: shergin Differential Revision: D6317674 fbshipit-source-id: 6bc331447458583a02c0e56d0d011a31d31d70a8
This commit is contained in:
parent
5aa1fb3ff3
commit
15179f1798
@ -59,6 +59,15 @@ RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii,
|
||||
};
|
||||
}
|
||||
|
||||
static UIEdgeInsets RCTRoundInsetsToPixel(UIEdgeInsets edgeInsets) {
|
||||
edgeInsets.top = RCTRoundPixelValue(edgeInsets.top);
|
||||
edgeInsets.bottom = RCTRoundPixelValue(edgeInsets.bottom);
|
||||
edgeInsets.left = RCTRoundPixelValue(edgeInsets.left);
|
||||
edgeInsets.right = RCTRoundPixelValue(edgeInsets.right);
|
||||
|
||||
return edgeInsets;
|
||||
}
|
||||
|
||||
static void RCTPathAddEllipticArc(CGMutablePathRef path,
|
||||
const CGAffineTransform *m,
|
||||
CGPoint origin,
|
||||
@ -195,6 +204,11 @@ static UIImage *RCTGetSolidBorderImage(RCTCornerRadii cornerRadii,
|
||||
const BOOL hasCornerRadii = RCTCornerRadiiAreAboveThreshold(cornerRadii);
|
||||
const RCTCornerInsets cornerInsets = RCTGetCornerInsets(cornerRadii, borderInsets);
|
||||
|
||||
// Incorrect render for borders that are not proportional to device pixel: borders get stretched and become
|
||||
// significantly bigger than expected.
|
||||
// Rdar: http://www.openradar.me/15959788
|
||||
borderInsets = RCTRoundInsetsToPixel(borderInsets);
|
||||
|
||||
const BOOL makeStretchable =
|
||||
(borderInsets.left + cornerInsets.topLeft.width +
|
||||
borderInsets.right + cornerInsets.bottomRight.width <= viewSize.width) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user