Skip to content

Commit fba4dcc

Browse files
authored
[iOS] Don't iterate to root while resolving recognizer (#4202)
## Description The updated loop in #4199 didn't accurately represent the semantics from the old arch. It didn't stop on the views managed by React Native, instead iterating to the root of the hierarchy. ## Test plan Checked that it doesn't regress #4199
1 parent 4b2bb5a commit fba4dcc

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -639,15 +639,19 @@ + (RNGestureHandler *)findGestureHandlerByRecognizer:(UIGestureRecognizer *)reco
639639

640640
// We may try to extract "DummyGestureHandler" in case when "otherGestureRecognizer" belongs to
641641
// a native view being wrapped with "NativeViewGestureHandler"
642-
RNGHUIView *reactView = recognizer.view;
643-
while (reactView != nil) {
644-
for (UIGestureRecognizer *recognizer in reactView.gestureRecognizers) {
645-
if ([recognizer isKindOfClass:[RNDummyGestureRecognizer class]]) {
646-
return recognizer.gestureHandler;
642+
RNGHUIView *view = recognizer.view;
643+
while (view != nil) {
644+
for (UIGestureRecognizer *candidateRecognizer in view.gestureRecognizers) {
645+
if ([candidateRecognizer isKindOfClass:[RNDummyGestureRecognizer class]]) {
646+
return candidateRecognizer.gestureHandler;
647647
}
648648
}
649649

650-
reactView = reactView.superview;
650+
if ([view isKindOfClass:[RCTViewComponentView class]]) {
651+
return nil;
652+
}
653+
654+
view = view.superview;
651655
}
652656

653657
return nil;

0 commit comments

Comments
 (0)