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

TextInput behavior on programmatic value change differs between iOS/Android #18578

Closed
3 tasks done
akalin-keybase opened this issue Mar 27, 2018 · 6 comments
Closed
3 tasks done
Labels
Bug Component: TextInput Related to the TextInput component. Platform: Android Android applications. Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@akalin-keybase
Copy link

akalin-keybase commented Mar 27, 2018

If one has a TextInput and changes its value prop, selection behavior differs between iOS and Android. On iOS, the cursor jumps to the end. On Android, the cursor moves to the right by some varying amount.

Also, if the TextInput has focus, on iOS no onSelectionChange even is fired, but one is on Android.

Finally, it would be nice if it were documented somewhere that the initial selection is at the end of the initial value.

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 9.9.0
Yarn: 1.5.1
npm: 5.8.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

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

Steps to Reproduce

See https://snack.expo.io/BJUeRfw5M

Expected Behavior

Consistent behavior between platforms. Jumping to the end of the line/value, perhaps, and firing an onSelectionChange event.

Documentation stating that the initial selection is at the end of the initial value.

Actual Behavior

On iOS, the cursor jumps to the end of the line, or the end of the replace text, sometimes. On Android, the cursor moves to the right by some varying amount.

Also, if the TextInput has focus, on iOS no onSelectionChange even is fired, but one is on Android.

@react-native-bot react-native-bot added Platform: iOS iOS applications. Platform: Android Android applications. Component: TextInput Related to the TextInput component. labels Mar 27, 2018
@akalin-keybase
Copy link
Author

A workaround is just to set selection explicitly. But doing so runs into #18316 , which also has its own workaround. https://github.com/akalin-keybase/rn-text-input-bugs has a demo that implements these workarounds.

@stale
Copy link

stale bot commented Jun 25, 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 Jun 25, 2018
@akalin-keybase
Copy link
Author

Not fixed AFAIK

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

any news on this issue?
I also ran into this problem, at least in part "if the TextInput has focus, on iOS no onSelectionChange even is fired" when programaticaly change value prop.

@stale
Copy link

stale bot commented Aug 2, 2019

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 Aug 2, 2019
@stale
Copy link

stale bot commented Aug 9, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Aug 9, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Aug 10, 2019
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: Android Android applications. Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants