mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 12:15:37 +08:00
Summary:
Calling -[UIScrollView setContentOffset] with NaN values can cause a crash. That's not clear why exactly the computation returns NaN sometime, but the implemented sanitizing should help to detect this problem during development (and this also prevents the app from crashing). See attached task for more details. Reviewed By: fkgozali Differential Revision: D13242729 fbshipit-source-id: 747bf1b42e02597e9f1300eee24547563ab29b27
This commit is contained in:
committed by
Facebook Github Bot
parent
d6d31a4b66
commit
585f7b916d
@@ -303,7 +303,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0;
|
||||
}
|
||||
}
|
||||
super.contentOffset = contentOffset;
|
||||
|
||||
super.contentOffset = CGPointMake(
|
||||
RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"),
|
||||
RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y"));
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
|
||||
Reference in New Issue
Block a user