Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix accessibilityState overwriting view's disabled state on Android (f…
…acebook#34287) Summary: While I was working on rewriting `react-native-slider` to Fabric I found a weird bug that prevented the slider to be set as disabled (to be exact: call the method `slider.setEnabled(false)`. As it turned out the `accessibilityState` (with value: `accessibilityState={{disabled: true}}` prop occurred after the `enabled={false}` prop that I was passing to the slider, which lead to both of this props overwrite each other. Handling of `accessibilityState` props inside view leads to always overwriting the enabled prop to true (even if we explicitly set it to `{disabled: false}`. Workaround for this was to reorder the props, so that the `accesibilityState` occur before `disabled`, but I think it's better to not set `view.setEnabled(true)` if we are passing a disabled property. ## Changelog [Android] [Fixed] - Fix accessibilityState overwriting view's disabled state on Android Pull Request resolved: facebook#34287 Test Plan: Change order of props inside native component implementation (that `disabled` occurs before `accesibilityState`). For example: `Libraries/Components/Slider/Slider.js` <details> <summary>Video showing the bug in RNTester (using Switch component)</summary> https://user-images.githubusercontent.com/52801365/181287547-964f50e2-55dc-450f-b413-0d1c14d4bb83.mp4 </details> Reviewed By: NickGerleman Differential Revision: D38209232 Pulled By: dmitryrykun fbshipit-source-id: 93d423716f89b45251be9d5aefcf01f7bd776f2c
- Loading branch information