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

[0.54] [iOS] Selection jumps to end of TextInput on every change #18341

Closed
larskarbo opened this issue Mar 13, 2018 · 14 comments
Closed

[0.54] [iOS] Selection jumps to end of TextInput on every change #18341

larskarbo opened this issue Mar 13, 2018 · 14 comments
Labels
Bug Component: TextInput Related to the TextInput component. Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@larskarbo
Copy link

On version 0.54.2 on iOS

When typing in a TextInput with a controlled value prop, multiple onSelectionChange events fires.

You don't always see the flickering when rendering, but this can cause problems if you have a very long TextInput or use the selection prop in other ways.

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 9.8.0
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.2 => 0.54.2

Expected Behavior

One onSelectionChange event is fired and cursor doesn't jump to end and back.

Actual Behavior

For every keystroke there is one instant correct event, then the new value goes through setState and renders down into the value prop again. This causes two more events: one where selection is at end of the string, followed by one correct event.

bug

Steps to Reproduce

The code I used to test is in this snack: https://snack.expo.io/HJaZucVYf

Use that code with v0.54.2 to reproduce

@maxlxq
Copy link

maxlxq commented Mar 13, 2018

me too

@hramos hramos added the Platform: iOS iOS applications. label Mar 13, 2018
@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Component: TextInput Related to the TextInput component. Platform: macOS Building on macOS. labels Mar 16, 2018
@akalin-keybase
Copy link

I think this happens only for multiline TextInputs.

@hramos hramos removed the Platform: macOS Building on macOS. label Mar 29, 2018
@vrgimael
Copy link

This seems to be causing other glitches, especially regarding how auto-correct detects changes.

It only happens on multiline indeed.

Any updates on the issue?

@vrgimael
Copy link

Update - this solved my problems:

ff70ecf#diff-a5239f085f0beab82ba2c1643be157ac

@matthieubessol
Copy link

I am also getting this. I'm on react-native v0.55.4. When I hit return two times and returning back to my previous text, letters are capitalized every time. Your code did fix the problem, but it would be nice if they fix it.

@stale
Copy link

stale bot commented Aug 19, 2018

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 "For Discussion" or "Good first issue" 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 Aug 19, 2018
@akalin-keybase
Copy link

this is still broken, afaik

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

stale bot commented Dec 21, 2018

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 "For Discussion" or "Good first issue" 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 Dec 21, 2018
@akalin-keybase
Copy link

this is still broken, afaik

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 21, 2018
@hramos hramos removed the Bug Report label Feb 6, 2019
@thymikee
Copy link
Contributor

Closing, because there's no recent activity under the issue.

@akalin-keybase if it still doesn't work for you, please create a new issue with a minimal reproduction we can investigate.

@jeffreybrowning
Copy link

If #18341 (comment) did fix, this remains an issue for Expo users as SDK 33 uses react-native 0.59

@mistikk
Copy link

mistikk commented Oct 25, 2019

Same issue on rn 0.61.2, please reopen to this issue @thymikee @jeffreybrowning

@nguyen95
Copy link

Me too, this happened on ios, rn 0.61.3

@jeffreybrowning
Copy link

I unfortunately do not have the power to reopen. Only commenting for 👀

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: TextInput Related to the TextInput component. Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests