Prevent RCTRootView delegate call
Reviewed By: javache Differential Revision: D2631582 fb-gh-sync-id: 409d439eb1dc8c7723892477dfaf58aa85c664b5
This commit is contained in:
parent
993f15d2fe
commit
760a2fc79a
|
@ -237,10 +237,20 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
|||
|
||||
- (void)setIntrinsicSize:(CGSize)intrinsicSize
|
||||
{
|
||||
if (!CGSizeEqualToSize(_intrinsicSize, intrinsicSize)) {
|
||||
_intrinsicSize = intrinsicSize;
|
||||
[_delegate rootViewDidChangeIntrinsicSize:self];
|
||||
BOOL oldSizeHasAZeroDimension = _intrinsicSize.height == 0 || _intrinsicSize.width == 0;
|
||||
BOOL newSizeHasAZeroDimension = intrinsicSize.height == 0 || intrinsicSize.width == 0;
|
||||
BOOL bothSizesHaveAZeroDimension = oldSizeHasAZeroDimension && newSizeHasAZeroDimension;
|
||||
|
||||
BOOL sizesAreEqual = CGSizeEqualToSize(_intrinsicSize, intrinsicSize);
|
||||
|
||||
_intrinsicSize = intrinsicSize;
|
||||
|
||||
// Don't notify the delegate if the content remains invisible or its size has not changed
|
||||
if (bothSizesHaveAZeroDimension || sizesAreEqual) {
|
||||
return;
|
||||
}
|
||||
|
||||
[_delegate rootViewDidChangeIntrinsicSize:self];
|
||||
}
|
||||
|
||||
- (NSNumber *)reactTag
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
@protocol RCTRootViewDelegate <NSObject>
|
||||
/**
|
||||
* Called after the root view's content is updated to a new size.
|
||||
* Called after the root view's content is updated to a new size. The method is not called
|
||||
* when both old size and new size have a dimension that equals to zero.
|
||||
*
|
||||
* The delegate can use this callback to appropriately resize the root view frame to fit the new
|
||||
* content view size. The view will not resize itself. The new content size is available via the
|
||||
|
|
Loading…
Reference in New Issue