Skip to content

Commit 59c3de7

Browse files
authored
[iOS] Fix ScrollView detection when used with NativeDetector (#3888)
## Description Our check for `ScrollView` was checking for `RCTScrollViewComponentView`, but inside NativeDetector, we extract `contentView` from `RCTViewComponentViews`: https://github.com/software-mansion/react-native-gesture-handler/blob/08c46d8232ce41dc195459b8b58b5d818bdfd15f/packages/react-native-gesture-handler/apple/RNGestureHandlerDetector.mm#L298-L303 And it so happens that `RCTScrollViewComponentView` inherits from `RCTViewComponentView`, which broke the `ScrollView` detection. The `contentView` of `RCTScrollViewComponentView` is `RCTEnhancedScrollView`. ## Test plan ScrollView from RNGH should now correctly delay touches on native buttons.
1 parent 6352af3 commit 59c3de7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react-native-gesture-handler/apple/RNGestureHandler.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#import <React/UIView+React.h>
1212

13+
#import <React/RCTEnhancedScrollView.h>
1314
#import <React/RCTParagraphComponentView.h>
1415
#import <React/RCTScrollViewComponentView.h>
1516

@@ -646,6 +647,10 @@ - (BOOL)isUIScrollViewPanGestureRecognizer:(NSGestureRecognizer *)gestureRecogni
646647

647648
- (RNGHUIScrollView *)retrieveScrollView:(RNGHUIView *)view
648649
{
650+
if ([view isKindOfClass:[RCTEnhancedScrollView class]]) {
651+
return (RCTEnhancedScrollView *)view;
652+
}
653+
649654
if ([view isKindOfClass:[RCTScrollViewComponentView class]]) {
650655
RNGHUIScrollView *scrollView = ((RCTScrollViewComponentView *)view).scrollView;
651656
return scrollView;

0 commit comments

Comments
 (0)