Repository navigation
feat(ios): support the enabled prop on iOS - #685
Merged
Naturalclar merged 1 commit intoNov 21, 2026
Merged
Naturalclar merged 1 commit into
Naturalclar merged 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #575. Also covers the disabled-announcement part of #215 for iOS.
Summary
enabledwas only honoured on Android, Web and Windows, so<Picker enabled={false} />left the iOS wheel interactive.When
enabled === false,PickerIOSnow:pointerEvents="none"on the wrapping view, so theUIPickerViewreceives no touches (the workaround people were applying by hand in enabled={false} not working on ios #575);accessibilityState.disabledon the native picker so screen readers announce it as disabled. A caller-suppliedaccessibilityStateis preserved.Behaviour is unchanged when
enabledis omitted ortrue. The change is JS-only, so it works on both Paper and Fabric.README,
Picker.jsand the typings now list iOS forenabled, andenabledis added toPickerIOSProps.Test plan
js/__tests__/PickerIOS.test.js: default andenabled: truestay interactive;enabled: falsesetspointerEvents='none'andaccessibilityState.disabled; existing accessibility state is merged.yarn validate:eslint,validate:flowandvalidate:typescriptpass.@react-native/babel-presetin a scratch copy: 4/4 pass. I didn't run it on a device or simulator.