File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -64,10 +64,20 @@ - (BOOL)shouldHandleTouch:(RNGHUIView *)view
6464 return button.userEnabled ;
6565 }
6666
67+ // Certain subviews such as RCTViewComponentView have been observed to have disabled
68+ // accessibility gesture recognizers such as _UIAccessibilityHUDGateGestureRecognizer,
69+ // ostensibly set by iOS. Such gesture recognizers cause this function to return YES
70+ // even when the passed view is static text and does not respond to touches. This in
71+ // turn prevents the button from receiving touches, breaking functionality. To handle
72+ // such case, we can count only the enabled gesture recognizers when determining
73+ // whether a view should receive touches.
74+ NSPredicate *isEnabledPredicate = [NSPredicate predicateWithFormat: @" isEnabled == YES " ];
75+ NSArray *enabledGestureRecognizers = [view.gestureRecognizers filteredArrayUsingPredicate: isEnabledPredicate];
76+
6777#if !TARGET_OS_OSX
68- return [view isKindOfClass: [UIControl class ]] || [view.gestureRecognizers count ] > 0 ;
78+ return [view isKindOfClass: [UIControl class ]] || [enabledGestureRecognizers count ] > 0 ;
6979#else
70- return [view isKindOfClass: [NSControl class ]] || [view.gestureRecognizers count ] > 0 ;
80+ return [view isKindOfClass: [NSControl class ]] || [enabledGestureRecognizers count ] > 0 ;
7181#endif
7282}
7383
You can’t perform that action at this time.
0 commit comments