facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.9k stars 24.3k forks source link

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

Open mhoran opened 5 years ago

mhoran commented 5 years ago

On iOS, when multline={true} is set on a TextInput, 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.

React Native version: 0.59

Steps To Reproduce

  1. Add multiline={true} to a TextInput
  2. Try to programmatically change the value of the text input when an autocorrect suggestion is present.
  3. 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 programmatic value to be set in the text input, as it is when multiline={false}.

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

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

Typing "Yo mh" and clicking the "Bananas!" text will result in the text box containing "Yo my oran", instead of "Yo mhoran". Changing multiline={true} to multiline={false} gives the expected behavior.

stale[bot] commented 4 years ago

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.

mhoran commented 4 years ago

This is still an issue.

stale[bot] commented 4 years ago

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.

mhoran commented 4 years ago

This is still an issue.

backmeupplz commented 4 years ago

Any news on this?

rikur commented 4 years ago

Related issue: https://github.com/facebook/react-native/issues/28025

fabOnReact commented 4 years ago

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

backmeupplz commented 4 years ago

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

backmeupplz commented 4 years ago

@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 commented 4 years ago

@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.

backmeupplz commented 4 years ago

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

Ashoat commented 4 years ago

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 commented 4 years ago

@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[bot] commented 1 year ago

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.

Ashoat commented 1 year ago

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?

mhoran commented 1 year ago

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