diff --git a/packages/react-strict-dom/src/native/modules/createStrictDOMComponent.js b/packages/react-strict-dom/src/native/modules/createStrictDOMComponent.js index 419eca47..76cc49bb 100644 --- a/packages/react-strict-dom/src/native/modules/createStrictDOMComponent.js +++ b/packages/react-strict-dom/src/native/modules/createStrictDOMComponent.js @@ -89,12 +89,23 @@ export function createStrictDOMComponent( // Component-specific props + // Forward `disabled` to the Pressable only when it is an explicit boolean, + // so that toggling `true` <-> `false` resets the native view's enabled + // state. On Android, re-enabling by dropping the prop (`true` -> `undefined`) + // leaves `accessibilityState.disabled` unset and the native `enabled` state + // stays false, making the Pressable unclickable. Emitting only for explicit + // booleans keeps elements that never opt into `disabled` unchanged; the + // `true` -> `undefined` transition is intentionally not covered, but a + // controlled `disabled` toggles `true` <-> `false`. if (NativeComponent === ReactNative.Pressable) { if (props.disabled === true) { // $FlowFixMe[react-rule-hook-mutation] nativeProps.disabled = true; // $FlowFixMe[react-rule-hook-mutation] nativeProps.focusable = false; + } else if (props.disabled === false) { + // $FlowFixMe[react-rule-hook-mutation] + nativeProps.disabled = false; } } diff --git a/packages/react-strict-dom/tests/html/__snapshots__/html-test.native.js.snap b/packages/react-strict-dom/tests/html/__snapshots__/html-test.native.js.snap index 26fc0ebc..43b4ea5e 100644 --- a/packages/react-strict-dom/tests/html/__snapshots__/html-test.native.js.snap +++ b/packages/react-strict-dom/tests/html/__snapshots__/html-test.native.js.snap @@ -216,6 +216,22 @@ exports[` (native polyfills) polyfills: layout default flex layout: flex `; +exports[` (native polyfills) polyfills: props