Fix accessibilityRespondsToUserInteraction not setting on first render (#51986)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51986

"{}" defaults to false on C++ but the prop is not initialized which means that if accessibilityEnablesUserInteraction is set to false it will not be applied on first render. setting the default to true fixes that issue

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D76532158

fbshipit-source-id: 51cba8b89eb239e01db985d412dd2b19e482f068
This commit is contained in:
Jorge Cabiedes Acosta
2025-06-16 10:22:05 -07:00
committed by Facebook GitHub Bot
parent 9613d377de
commit e13ee7a3d0
2 changed files with 5 additions and 2 deletions
@@ -162,7 +162,7 @@ AccessibilityProps::AccessibilityProps(
rawProps,
"accessibilityRespondsToUserInteraction",
sourceProps.accessibilityRespondsToUserInteraction,
{})),
true)),
onAccessibilityTap(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onAccessibilityTap
@@ -49,7 +49,10 @@ class AccessibilityProps {
bool accessibilityViewIsModal{false};
bool accessibilityElementsHidden{false};
bool accessibilityIgnoresInvertColors{false};
bool accessibilityRespondsToUserInteraction{};
// This prop is enabled by default on iOS, we need to match this on
// C++ because if not, it will default to false before render which prevents
// the view from being updated with the correct value.
bool accessibilityRespondsToUserInteraction{true};
bool onAccessibilityTap{};
bool onAccessibilityMagicTap{};
bool onAccessibilityEscape{};