From d8f43105ed99b2aed327418261535c010119bfb3 Mon Sep 17 00:00:00 2001 From: Tj Date: Tue, 4 Aug 2015 16:54:09 -0700 Subject: [PATCH] [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](https://github.com/facebook/react-native/issues/2075). Closes https://github.com/facebook/react-native/pull/2224 Github Author: Tj --- React/Views/RCTScrollView.m | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/React/Views/RCTScrollView.m b/React/Views/RCTScrollView.m index fbdcf3474..5c6e5f10a 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -339,20 +339,16 @@ RCT_NOT_IMPLEMENTED(-init) - (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]; } @end