mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
[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 <tfallon@Tjs-MBP.local>
This commit is contained in:
parent
f165bbaf4e
commit
d8f43105ed
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user