mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 13:25:51 +08:00
Prevent RCTRootView delegate call
Reviewed By: javache Differential Revision: D2631582 fb-gh-sync-id: 409d439eb1dc8c7723892477dfaf58aa85c664b5
This commit is contained in:
committed by
facebook-github-bot-9
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
|
||||
|
||||
Reference in New Issue
Block a user