Skip to content

Commit d8f4310

Browse files
TjTj
authored andcommitted
[ListView] Fix RCTScrollView stickyHeader touch passing.
Summary: Point must be converted to the stickyHeader's coordinate space and then passed to the stickyHeaders hitTest:withEvent: method in order to be correctly routed to any subviews of the stickyHeader. This resolves this [issue](facebook/react-native#2075). Closes facebook/react-native#2224 Github Author: Tj <tfallon@Tjs-MBP.local>
1 parent f165bba commit d8f4310

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

React/Views/RCTScrollView.m

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,16 @@ - (void)dockClosestSectionHeader
339339

340340
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
341341
{
342-
__block UIView *stickyHeader;
342+
__block UIView *hitView;
343343

344344
[_stickyHeaderIndices enumerateIndexesWithOptions:0 usingBlock:^(NSUInteger idx, BOOL *stop) {
345-
stickyHeader = [self contentView].reactSubviews[idx];
345+
UIView *stickyHeader = [self contentView].reactSubviews[idx];
346346
CGPoint convertedPoint = [stickyHeader convertPoint:point fromView:self];
347-
348-
if ([stickyHeader hitTest:convertedPoint withEvent:event]) {
349-
*stop = YES;
350-
} else {
351-
stickyHeader = nil;
352-
}
347+
hitView = [stickyHeader hitTest:convertedPoint withEvent:event];
348+
*stop = (hitView != nil);
353349
}];
354350

355-
return stickyHeader ?: [super hitTest:point withEvent:event];
351+
return hitView ?: [super hitTest:point withEvent:event];
356352
}
357353

358354
@end

0 commit comments

Comments
 (0)