Fixed hitTest crash due to sticky header out-of-range

Reviewed By: javache

Differential Revision: D2932227

fb-gh-sync-id: 05d69ec391685dd7e72d3d5f7d56b189a6eab413
shipit-source-id: 05d69ec391685dd7e72d3d5f7d56b189a6eab413
This commit is contained in:
Nick Lockwood 2016-02-12 09:27:21 -08:00 committed by facebook-github-bot-7
parent 9547264a96
commit 194273f5f5
1 changed files with 7 additions and 1 deletions

View File

@ -349,8 +349,14 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
{
__block UIView *hitView;
NSArray *subviews = [self contentView].reactSubviews;
NSUInteger subviewCount = subviews.count;
[_stickyHeaderIndices enumerateIndexesWithOptions:0 usingBlock:^(NSUInteger idx, BOOL *stop) {
UIView *stickyHeader = [self contentView].reactSubviews[idx];
if (idx >= subviewCount) {
*stop = YES;
return;
}
UIView *stickyHeader = subviews[idx];
CGPoint convertedPoint = [stickyHeader convertPoint:point fromView:self];
hitView = [stickyHeader hitTest:convertedPoint withEvent:event];
*stop = (hitView != nil);