From 03370c6ea244fbbed247185d26348a8a1f24073b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Mon, 14 Sep 2026 12:59:48 +0200 Subject: [PATCH] Skip hidden and transparent buttons in hit testing --- .../apple/RNGestureHandlerButtonComponentView.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm b/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm index 4931eb23bd..d479d51570 100644 --- a/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm +++ b/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm @@ -613,8 +613,14 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & // This is necessary because RCTViewComponentView's hitTest might handle pointerEvents // from ViewProps and prevent touches from reaching _buttonView (which is the contentView). // Since _buttonView has its own pointerEvents handling, we always forward to it. +// Keep the visibility checks RCTViewComponentView applies, so a hidden or +// (nearly) transparent button is skipped like any other RN view. - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { + if (!self.userInteractionEnabled || self.hidden || self.alpha < 0.01) { + return nil; + } + if (![self pointInside:point withEvent:event]) { return nil; }