Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apple/RNGestureHandlerButton.mm
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,20 @@ - (BOOL)shouldHandleTouch:(RNGHUIView *)view
return button.userEnabled;
}

// Certain subviews such as RCTViewComponentView have been observed to have disabled
// accessibility gesture recognizers such as _UIAccessibilityHUDGateGestureRecognizer,
// ostensibly set by iOS. Such gesture recognizers cause this function to return YES
// even when the passed view is static text and does not respond to touches. This in
// turn prevents the button from receiving touches, breaking functionality. To handle
// such case, we can count only the enabled gesture recognizers when determining
// whether a view should receive touches.
NSPredicate *isEnabledPredicate = [NSPredicate predicateWithFormat:@"isEnabled == YES"];
NSArray *enabledGestureRecognizers = [view.gestureRecognizers filteredArrayUsingPredicate:isEnabledPredicate];

#if !TARGET_OS_OSX
return [view isKindOfClass:[UIControl class]] || [view.gestureRecognizers count] > 0;
return [view isKindOfClass:[UIControl class]] || [enabledGestureRecognizers count] > 0;
#else
return [view isKindOfClass:[NSControl class]] || [view.gestureRecognizers count] > 0;
return [view isKindOfClass:[NSControl class]] || [enabledGestureRecognizers count] > 0;
#endif
}

Expand Down
Loading