Reuse TouchableHighlight accessibility state without ARIA overrides (#59807)

Summary:

Use the supplied `accessibilityState` as the default and only build a new state object when an ARIA state prop overrides it. This avoids reconstructing a sparse state object with extra undefined fields when no ARIA override is supplied. ARIA precedence and the explicit `disabled` override are unchanged.

Refresh the affected snapshots and assert that the button keeps its empty accessibility state.

Changelog: [Internal]

Differential Revision: D129885143

Pull Request resolved: https://github.com/react/react-native/pull/59807
This commit is contained in:
Pieter De Baets authored and GitHub committed 2026-11-13 16:42:24 +00:00
1 parent 718b6150b1
commit 649c1054e7
1 file changed
+1 -2
@@ -231,9 +231,8 @@ class TouchableHighlightImpl extends React.Component<
'aria-selected': ariaSelected,
} = this.props;
let _accessibilityState: ?AccessibilityState;
let _accessibilityState: ?AccessibilityState = accessibilityState;
if (
accessibilityState != null ||
ariaBusy != null ||
ariaChecked != null ||
ariaDisabled != null ||