[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:
Родитель
f165bbaf4e
Коммит
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче