This repository has been archived by the owner on Mar 4, 2022. It is now read-only.
forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix ios bug where <TextInput> ignored value prop
The value in the native text input would sometimes be respected over the value passed in. This was specifically an issue for text normalization: for example, if we wanted to only allow digits in a text field and a user enters "123a", the attributedText passed in from JS is "123" (since it gets normalized), _previousAttributedText is "123" (since that was the last value updated from the JS, but baseTextInputView.attributedText is "123a" (since that gets updated by the native event). In that scenario, the text in the input never gets normalized. There's a comment warning about not notifying the view of a text change that isn't a real update, but as far as I can tell, this is a non-issue here because RCTBaseTextInputView does its own checks to see if values have changed. This implementation was inspired by PR facebook#19087, but simplifies by removing `_previousAttributedText` entirely and avoids breaking uncontrolled text inputs.
- Loading branch information
Showing
4 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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