Repository navigation
(Android) Incorrect key reported from TextInput onKeyPress event #18262
Description
Activity
- addedIssue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.This issue can be reproduced in Snack or an attached project.Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.
on Mar 8, 2018 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!
Can you find any other cases where the output is inconsistent between iOS & Android?I'll have to think about the event order inconsistency separately as there's more implementation dependent on either platform.
Reacted by elliscwc, Stan Chang and Bartosz SumperI'll be sure to report more if I find them! 👍 Thanks for the reply!
- addedRan CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.Component: TextInputRelated to the TextInput component.Related to the TextInput component.
on Mar 16, 2018 react-native-bot commented
on Mar 16, 2018 on Mar 16, 2018 · Hidden as outdatedshow commentMore actions- addedRan CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.
on Mar 16, 2018 - addedPlatform: AndroidAndroid applications.Android applications.Ran CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.
on Mar 18, 2018 1 remaining item
@joshyhargreaves
I face the same issue with onKeyPress on android.
onKeyPress can trigger key event properly if the keyboardType="default",
otherwise, when I use the "numeric" keyboardType, onKeyPress cannot trigger the number key events.
It only works with backspace, dot, comma, key events.Could anyone help with this issue?
Here is my react-native info:
Environment:
OS: macOS High Sierra 10.13.4
Node: 8.11.1
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.1 AI-173.4697961Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.3
react-native: 0.54.2 => 0.54.2@joshyhargreaves you say
I'll have to think about the event order inconsistency separately as there's more implementation dependent on either platform.
Does that mean the bug is likely in the c++ code? looking into this.
Yess, I believe its because native compiler
- removedGood first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.
on Mar 19, 2019 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.
- locked as resolved and limited conversation to collaborators
on Mar 19, 2020 - addedResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
on Mar 19, 2020
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
Enterkey on key press event, you receiveBackspaceande.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
Enterkey on key press event, you will receiveBackspaceande.Steps to Reproduce
react-native run-androidreact-native log-androidif you need to see the log yourselfOutput (comments describe the user input event)