forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Add cursorColor support to TextInput #1787
Merged
Merged
Conversation
This file contains 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
@microsoft-github-policy-service agree company="Meta" |
Saadnajmi
reviewed
Apr 12, 2023
Thanks for the review! 👍 Addressed comments |
Saadnajmi
reviewed
Apr 13, 2023
Saadnajmi
approved these changes
Apr 13, 2023
4 tasks
jonthysell
pushed a commit
to microsoft/react-native-windows
that referenced
this pull request
Apr 21, 2023
## Description I've added the support for the `cursorColor` property to the macOS repo already. This PR will help to keep parity between platforms microsoft/react-native-macos#1787 ### Type of Change - New feature (non-breaking change which adds functionality) ### Why For our needs, we need to have more control over cursor/caret color. The `cusrorColor` property is already available on macOS after microsoft/react-native-macos#1787 and documented in the docs https://reactnative.dev/docs/textinput#cursorcolor-android. However, there is currently no way to update the cursor/caret color on Windows. ### What - I've extended `HideCaretIfNeeded` logic to support the custom color of a caret. This function is already, in a sense, changing the color of a caret; however, it always sets it to be transparent. Now, we allow custom colors as well - Updated demo textinput page to have test cases for it ## Screenshots https://user-images.githubusercontent.com/963490/232445282-96c509e8-801d-4009-bbfd-c061340f53e8.mp4
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.
Please select one of the following
Summary
In the current implementation of TextInput, there is no reliable way to specify cursorColor (caret color).
This prop is already supported in Android and documented in the main doc https://reactnative.dev/docs/textinput#cursorcolor-android This pull request adds support to macOS as well.
To demonstrate, here cursor is actually rendered, but you cannot see it as it is black on black.
Screen.Recording.2023-04-12.at.12.01.33.mov
TextInput implementation seems to be different between MacOS and iOS, so creating a pull request here.
Changelog
[MACOS] [ADDED] - Added support for cursorColor prop in TextInput
Test Plan
Run RNTester-macOS as explained in the guide https://github.com/microsoft/react-native-macos/tree/main/packages/rn-tester#running-on-ios
Screen.Recording.2023-04-12.at.12.08.20.mov