mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 06:04:15 +00:00
More accurate implementation of RCTRootView
's sizeThatFits:
Reviewed By: mmmulani Differential Revision: D4672788 fbshipit-source-id: 780487f2264916349e32785808a93ed6f957e471
This commit is contained in:
parent
2976aa12bc
commit
98798a06ae
@ -153,10 +153,22 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
|||||||
|
|
||||||
- (CGSize)sizeThatFits:(CGSize)size
|
- (CGSize)sizeThatFits:(CGSize)size
|
||||||
{
|
{
|
||||||
return CGSizeMake(
|
CGSize fitSize = _intrinsicContentSize;
|
||||||
_sizeFlexibility & RCTRootViewSizeFlexibilityWidth ? MIN(_intrinsicContentSize.width, size.width) : size.width,
|
CGSize currentSize = self.bounds.size;
|
||||||
_sizeFlexibility & RCTRootViewSizeFlexibilityHeight ? MIN(_intrinsicContentSize.height, size.height) : size.height
|
|
||||||
);
|
// Following the current `size` and current `sizeFlexibility` policy.
|
||||||
|
fitSize = CGSizeMake(
|
||||||
|
_sizeFlexibility & RCTRootViewSizeFlexibilityWidth ? fitSize.width : currentSize.width,
|
||||||
|
_sizeFlexibility & RCTRootViewSizeFlexibilityHeight ? fitSize.height : currentSize.height
|
||||||
|
);
|
||||||
|
|
||||||
|
// Following the given size constraints.
|
||||||
|
fitSize = CGSizeMake(
|
||||||
|
MIN(size.width, fitSize.width),
|
||||||
|
MIN(size.height, fitSize.height)
|
||||||
|
);
|
||||||
|
|
||||||
|
return fitSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)layoutSubviews
|
- (void)layoutSubviews
|
||||||
|
Loading…
x
Reference in New Issue
Block a user