-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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 order of events are inconsistent between iOS and Android #18221
Comments
https://github.com/leighman/react-native-text-input-selection-crash for reproduction of crash when setting selection and text at the same time. |
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run Thank you for your contributions. |
happens in 0.55 as well. |
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run Thank you for your contributions. |
FWIW, I made this Snack to help debug the On Android this logs in the following order:
Env:
|
Does anyone have a workaround? |
This comment has been minimized.
This comment has been minimized.
I have the same issue, I try to process input’s value on “Backspace” key so I store key in onKeyPress event handler and I use it in onChange event handler but I found undefined because onChange get fired before onKeyPress, please help |
Experiencing this issue too. I have to use a differently ordered combination of onChangeText and onSelectionChange to handle the same text function on iOS and Android. |
My workaround is acting like the
|
Also seeing this on RN 0.59.1. There is no workaround other than to handle Android differently from iOS as far as I know |
For me on RN 0.59.1 this gets even more weird. When I press any letter then
But when I press any digit then
Maybe that's for another issue though.. |
We're also having problems with this, would be great to get the order standardized. I think onKeyPress should always come before onChangeText. |
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. |
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. |
TextInput event order are different for iOS and Android.
This inconsistency make certain operations hard to archive on Android:
change text event
beforeselection change event
can cause crash due to invalid selection.Environment
Tested on Expo 25.0.0/0.52.0, but original issue happen in 0.53.3 as well, Likely exist in 0.54.0
Expected Behavior
I think iOS order of events make the most sense and I hope Android can follow the suit.
Actual Behavior
The event in question are
onChangeText()
,onSelectionChange()
andonKeyPress()
.On iOS, the events are in the following order:
On Android, the events are in the following order:
Steps to Reproduce
https://snack.expo.io/Hk2qtCouf
The text was updated successfully, but these errors were encountered: