Skip to content
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

Setting the value of a controlled TextInput breaks when autocorrect suggestion present #27019

Open
mhoran opened this issue Oct 27, 2019 · 18 comments
Labels
Bug Component: TextInput Related to the TextInput component. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: iOS iOS applications.

Comments

@mhoran
Copy link

mhoran commented Oct 27, 2019

On iOS, something wonky happens when the value of a TextInput is programmatically modified (via setState and the value property of said TextInput) and an autocorrect suggestion is present.

The value of the text input ends up being set to the combination of the autocorrect suggestion and the programmatic value. This only happens when multiline={true}. When multiline={false}, all is fine.

This seems only to be reproducible on iOS. I was not able to reproduce on the Snack iOS simulator. This can be reproduced using the software keyboard in the Snack iOS simulator with multiline={true}. The Snack iOS simulator does not reproduce with multiline={false}, but this does reproduce on a device.

React Native version: 0.59-0.76

Steps To Reproduce

  1. Start the reproducer: https://snack.expo.dev/@mhoran/trusting-peanut
  2. Type "Yo mh" and wait for the auto-correct suggestion of "my"
  3. Click "Bananas!"
  4. Notice that the value set programmatically will become a combination of the autocorrect value and the programmatic value.

Describe what you expected to happen:

I expected the value to be set to "Yo mhoran".

Snack, code example, screenshot, or link to a repository:

https://snack.expo.dev/@mhoran/trusting-peanut

@mhoran mhoran added the Bug label Oct 27, 2019
@react-native-bot react-native-bot added the Component: TextInput Related to the TextInput component. label Oct 27, 2019
mhoran added a commit to mhoran/weechatRN that referenced this issue Oct 27, 2019
There's a bug on iOS with TextInput when multiline=true and the value of
the TextInput is programmatically changed.

See facebook/react-native#27019.
@stale
Copy link

stale bot commented Jan 25, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 25, 2020
@mhoran
Copy link
Author

mhoran commented Jan 26, 2020

This is still an issue.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 26, 2020
@stale
Copy link

stale bot commented Apr 25, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 25, 2020
@mhoran
Copy link
Author

mhoran commented Apr 25, 2020

This is still an issue.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 25, 2020
@backmeupplz
Copy link

Any news on this?

@rikur
Copy link

rikur commented May 20, 2020

Related issue: #28025

@fabOnReact
Copy link
Contributor

you did not provide the info, the issue was not flagged as Platform iOS

@backmeupplz
Copy link

@fabriziobertoglio1987 what info should be provided? Sorry, I'm not OP but I can help with my case.

@backmeupplz
Copy link

@rikur tried it before, didn't work well :( the textfield was popping in and out of editting state, not finishing at the desired state :(

@backmeupplz
Copy link

@fabriziobertoglio1987 should we do anything about this issue? Should I publish a new issue like this but with better details about the case? I mean, I have the same issue as OP.

@Ashoat Ashoat added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: iOS iOS applications. labels Jun 16, 2020
@backmeupplz
Copy link

@Ashoat do we need to provide any more info about this?

@Ashoat
Copy link
Contributor

Ashoat commented Jun 30, 2020

I don't think so, the repro should be enough. I wouldn't expect anybody to solve this for you anytime soon though. If you need it fixed the best solution would be to put up a PR.

@fabOnReact
Copy link
Contributor

fabOnReact commented Jul 21, 2020

@backmeupplz I'm sorry. I don't work on iOS. I just work on Android. I hope somebody working on iOS will be bable to help you. Thanks a lot. Sorry I did not read the other emails. I wish you a good day. Fabrizio

about the info, I was referring to the output from react-native info which allows the bot to add a Tag. I use that tag to filter Android issues as I don't work on iOS, but nevermind. Seems that the issue is tagged now. Thanks a lot.

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 25, 2023
@Ashoat
Copy link
Contributor

Ashoat commented Mar 25, 2023

The Expo snack repro doesn't appear to work in Expo 47. Would somebody mind updating it so that this issue doesn't go stale?

@github-actions github-actions bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 25, 2023
@mhoran
Copy link
Author

mhoran commented Mar 25, 2023

Updated the Snack: https://snack.expo.dev/@mhoran/trusting-peanut.

@mhoran
Copy link
Author

mhoran commented Oct 27, 2024

This issue persists with React Native 0.76.0 and New Arch.

@mhoran
Copy link
Author

mhoran commented Oct 28, 2024

This is also an issue for single-line TextInputs now as well, and and is not tied to old vs new architecture. As a workaround I was able to set autoCorrect={false}.

The issue does not seem to repro in the Snack with single-line TextInput but on a device I see this behavior. It could have something to do with the speed of the device.

@mhoran mhoran changed the title Setting the value of a multiline TextInput with breaks when autocorrect suggestion present Setting the value of a controlled TextInput breaks when autocorrect suggestion present Oct 28, 2024
mhoran added a commit to mhoran/weechatRN that referenced this issue Oct 28, 2024
Multiline input had been disabled to work around
facebook/react-native#27019. However, that
workaround no long seems to be working.

Instead, disable autoCorrect, which does work around the above issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Component: TextInput Related to the TextInput component. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: iOS iOS applications.
Projects
None yet
Development

No branches or pull requests

6 participants