Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ListView] Fix RCTScrollView stickyHeader touch passing. #2224

Closed
wants to merge 1 commit into from
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