From 46da7888490b7d8e414563989b1633719e6004e1 Mon Sep 17 00:00:00 2001 From: Tj Date: Tue, 4 Aug 2015 13:40:29 -0400 Subject: [PATCH] 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. More performant fix. Fix tabs. --- 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 bc4db361ee9895..334305f697be21 100644 --- a/React/Views/RCTScrollView.m +++ b/React/Views/RCTScrollView.m @@ -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]; } @end