-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
(Android) Incorrect key reported from TextInput onKeyPress event #18262
Comments
Thank you for reporting this, as I'm sure you know, this is a new feature on Android & it's a hard thing to get right on the first attempt! I'll have to think about the event order inconsistency separately as there's more implementation dependent on either platform. |
I'll be sure to report more if I find them! 👍 Thanks for the reply! |
This comment has been minimized.
This comment has been minimized.
@joshyhargreaves Could anyone help with this issue? Here is my react-native info: Environment: Packages: (wanted => installed) |
@joshyhargreaves you say
Does that mean the bug is likely in the c++ code? looking into this. |
Yess, I believe its because native compiler |
This issue has been open and reproduced on a really old version of React Native. We have contributed a lot of improvements to TextInput on Android since then. I am going to close it hoping it doesn't happen anymore. In case it does happen on 0.59, please let me know and let's reopen. |
There are cases where
<TextInput />
onKeyPress()
event report incorrect keys.If you place your selection cursor at the start of the line and press enter, instead of receiving
Enter
key on key press event, you receiveBackspace
ande
.It only happen if you do this on the start of the line. If I move selection cursor to end of line and press enter, it function correctly.
Notice also how the order of events are different for happy case and edge case, which is related to #18221.
Environment
Expected Behavior
Report the correct key press, in my case,
Enter
.Actual Behavior
It only happen if you do this at the start of the line. Instead of receiving
Enter
key on key press event, you will receiveBackspace
ande
.Steps to Reproduce
react-native run-android
react-native log-android
if you need to see the log yourselfOutput (comments describe the user input event)
The text was updated successfully, but these errors were encountered: