Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions React/Views/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -339,20 +339,16 @@ - (void)dockClosestSectionHeader

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
__block UIView *stickyHeader;
__block UIView *hitView;

[_stickyHeaderIndices enumerateIndexesWithOptions:0 usingBlock:^(NSUInteger idx, BOOL *stop) {
stickyHeader = [self contentView].reactSubviews[idx];
UIView *stickyHeader = [self contentView].reactSubviews[idx];
CGPoint convertedPoint = [stickyHeader convertPoint:point fromView:self];

if ([stickyHeader hitTest:convertedPoint withEvent:event]) {
*stop = YES;
} else {
stickyHeader = nil;
}
hitView = [stickyHeader hitTest:convertedPoint withEvent:event];
*stop = (hitView != nil);
}];

return stickyHeader ?: [super hitTest:point withEvent:event];
return hitView ?: [super hitTest:point withEvent:event];
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could change __block UIView *stickyHeader to __block UIView *hitView and set it inside the enumeration loop, avoiding an extra hitTest: call at the end of this method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I missed that bit. That's the problem. Let me update this.

@end
Expand Down