Skip to content

feat(ios): support the enabled prop on iOS - #685

Merged
Naturalclar merged 1 commit into
react-native-picker:masterfrom
officialasishkumar:feat/ios-enabled-prop
Nov 21, 2026
Merged

Naturalclar merged 1 commit into
react-native-picker:masterfrom
officialasishkumar:feat/ios-enabled-prop

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Fixes #575. Also covers the disabled-announcement part of #215 for iOS.

Summary

enabled was only honoured on Android, Web and Windows, so <Picker enabled={false} /> left the iOS wheel interactive.

When enabled === false, PickerIOS now:

  • sets pointerEvents="none" on the wrapping view, so the UIPickerView receives no touches (the workaround people were applying by hand in enabled={false} not working on ios #575);
  • sets accessibilityState.disabled on the native picker so screen readers announce it as disabled. A caller-supplied accessibilityState is preserved.

Behaviour is unchanged when enabled is omitted or true. The change is JS-only, so it works on both Paper and Fabric.

README, Picker.js and the typings now list iOS for enabled, and enabled is added to PickerIOSProps.

Test plan

  • Added js/__tests__/PickerIOS.test.js: default and enabled: true stay interactive; enabled: false sets pointerEvents='none' and accessibilityState.disabled; existing accessibility state is merged.
  • yarn validate:eslint, validate:flow and validate:typescript pass.
  • The repo's jest 26 setup currently can't start against RN 0.83, so I ran the new tests with jest 29 and @react-native/babel-preset in a scratch copy: 4/4 pass. I didn't run it on a device or simulator.

The enabled prop was only honoured on Android, Web and Windows, so
<Picker enabled={false} /> left the iOS wheel fully interactive (react-native-picker#575).

When enabled is false, PickerIOS now sets pointerEvents="none" on the
wrapping view so the UIPickerView stops receiving touches, and marks the
native picker with accessibilityState.disabled so screen readers announce
it as disabled (see react-native-picker#215). Any accessibilityState supplied by the caller is
preserved. Behaviour is unchanged when enabled is omitted or true.

Also documents iOS support for the prop in the README and typings, adds
enabled to the PickerIOS typings, and adds tests covering the enabled,
disabled and merged accessibility state cases.

@Naturalclar Naturalclar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Naturalclar
Naturalclar merged commit 6c0ec77 into react-native-picker:master Nov 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enabled={false} not working on ios

2 participants