-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
android controlled text input not working as expected (duplicates the given string) #30393
Comments
Thanks @Niryo, me and @safaiyeh wrote two prs #27757 #29070 to fix a similar issue in TextInput that may offer some guidance in understanding how TextInput state in ReactNative TextInput.js and ReactAndroid TextInput component is stored... #29070 was trying to fix issue caused by
The difference between
As explained #29070 (comment) and #29063 (comment), if you set the TextInput value state in JavaScript and then change the text (for example
as you can see in my pr https://github.com/facebook/react-native/pull/29070/files#diff-637b194a475487dde7656c3f35995fbe49c800b79b19be01e89ffe22ac98df49R125-R134 and the above gifs, I was able to create TextInput which would fully control the TextInput state (position and value) on the JS Side, this way finding a workaround around the limitations of the current Java/JavaScript API But I believe this is not a good solution as it introduces a regression on iOS I believe that the TextInput useEffect hook should detect this update in the JS TextInput value and trigger update on the Java TextInput internal state #29070 (comment)
react-native/Libraries/Components/TextInput/TextInput.js Lines 903 to 913 in 1d05d46
react-native/Libraries/Components/TextInput/TextInput.js Lines 898 to 900 in 1d05d46
for this reason and given the limited amount of time available, I decided to work on other easier to solve issues. Thanks a lot |
To answer the question of when the pr #29070 which fixes this issue will be released in the next version of React Native, I suggest you to follow the discussions at https://github.com/react-native-community/releases/issues by subscribing to those threads. The process of releasing a new version with a bug fix is the following:
|
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Do you still experience this issue? I have four years of experience maintaining facebook/react-native and I specialize in the Text and TextInput components. I currently have 58 facebook/react-native PRs. If you still experience this issue, I will prepare a patched release with the fix. Thanks a lot |
This PR is included in the react-native-improved library: react-native-improved
Set-upIn package.json "scripts": {
+ "postinstall": "yarn run react-native-patch"
} Then npmnpm install react-native-improved --save-dev yarn v1yarn add react-native-improved --dev |
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
basically this is a reopening of this issue: #19085
on my Xiaomi a1 device, when trying to use a controlled textInput, the input goes crazy and start adding duplications of the current string. Adding
visible-password
to keyboardType solves the issue, but it doesn't fit my use-case.React Native version:
[email protected]
Steps To Reproduce
The text was updated successfully, but these errors were encountered: