-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: selectionHandleColor prop on Android #41092
Conversation
1521e8b
to
eb5647b
Compare
eb5647b
to
c411416
Compare
Base commit: c267a06 |
Thanks for contributing! Having props that overlap require careful handling. If in a state update you change just Can you validate that when you change these properties in different order (eg add useState hook to control each individually) that this still works correctly? |
Hi @javache, During the testing, I also found incorrect behavior when changing from color to selectionHandleColor-order-test.mov |
packages/react-native/Libraries/Components/TextInput/TextInput.js
Outdated
Show resolved
Hide resolved
… they're not both in otherProps and colorProps.
@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: This PR addresses the problem raised in the facebook#41004 issue. The current logic is that `selectionColor` on iOS sets the color of the selection, handles, and cursor. On Android it looks similar, while it doesn't change the color of the handles if the API level is higher than 27. In addition, on Android there was an option to set the color of the cursor by `cursorColor` prop, but it didn't work if the `selectionCursor` was set. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [ADDED] - Make same behavior of the `selectionColor` prop on Android as iOS [ANDROID] [ADDED] - Introduced `selectionHandleColor` as a separate prop [ANDROID] [CHANGED] - Allowing `cursorColor` and `selectionHandleColor` to override `selectionColor` on Android Pull Request resolved: facebook#41092 Test Plan: Manual tests in rn-tester: ### `selectionColor` same as iOS, sets selection, handles and cursor color _There is a way to set only "rectangle" color by setting other props as null_ ![image](https://github.com/facebook/react-native/assets/39670088/9cba34c2-c9fc-4d84-a9cb-3b28a754671d) ### `selectionHandleColor` ![image](https://github.com/facebook/react-native/assets/39670088/8a7e488e-0e35-4646-9efe-4783420b41fa) ### `cursorColor` ![image](https://github.com/facebook/react-native/assets/39670088/06798b8a-851f-44c7-979e-a4e74681b29a) Reviewed By: NickGerleman Differential Revision: D51253298 Pulled By: javache fbshipit-source-id: 290284aa38c6ba0aa6998b937258788ce6376431
Summary:
This PR addresses the problem raised in the #41004 issue.
The current logic is that
selectionColor
on iOS sets the color of the selection, handles, and cursor. On Android it looks similar, while it doesn't change the color of the handles if the API level is higher than 27. In addition, on Android there was an option to set the color of the cursor bycursorColor
prop, but it didn't work if theselectionCursor
was set.Changelog:
[GENERAL] [ADDED] - Make same behavior of the
selectionColor
prop on Android as iOS[ANDROID] [ADDED] - Introduced
selectionHandleColor
as a separate prop[ANDROID] [CHANGED] - Allowing
cursorColor
andselectionHandleColor
to overrideselectionColor
on AndroidTest Plan:
Manual tests in rn-tester:
selectionColor
same as iOS, sets selection, handles and cursor colorThere is a way to set only "rectangle" color by setting other props as null
selectionHandleColor
cursorColor