From 6d97179f0f56668ac50db7a09cf3397279eef4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 21 May 2026 11:05:24 +0200 Subject: [PATCH 1/2] Fix duplicated testID --- .../apple/RNGestureHandlerButtonComponentView.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm b/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm index 85f9ff8bb6..bb0ffb706f 100644 --- a/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm +++ b/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm @@ -360,6 +360,15 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & } [super updateProps:props oldProps:oldProps]; + // super's updateProps sets self.accessibilityIdentifier from testID via the + // standard Fabric mechanism. However, setAccessibilityProps already forwards + // testID to _buttonView.accessibilityIdentifier (the actual button element). + // Having the identifier on both views causes testing frameworks (e.g. Detox) + // to report multiple matches for the same testID. Clear it from the wrapper so + // only _buttonView carries the identifier. + if (!newProps.testId.empty()) { + self.accessibilityIdentifier = nil; + } if (shouldApplyStartAnimationState) { [_buttonView applyStartAnimationState]; } From b3c65aabb55f7674eade40db11b5cf1deb9529c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 21 May 2026 11:16:49 +0200 Subject: [PATCH 2/2] Add if --- .../apple/RNGestureHandlerButtonComponentView.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm b/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm index bb0ffb706f..af27a5a3d0 100644 --- a/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm +++ b/packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm @@ -360,6 +360,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & } [super updateProps:props oldProps:oldProps]; + +#if !TARGET_OS_TV && !TARGET_OS_OSX // super's updateProps sets self.accessibilityIdentifier from testID via the // standard Fabric mechanism. However, setAccessibilityProps already forwards // testID to _buttonView.accessibilityIdentifier (the actual button element). @@ -369,6 +371,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & if (!newProps.testId.empty()) { self.accessibilityIdentifier = nil; } +#endif + if (shouldApplyStartAnimationState) { [_buttonView applyStartAnimationState]; }