On Android, the onKeyPress callback returns the wrong key value when the TextInput has the maxLength property
Description
In Android, when a TextInput with the maxLength property is "full"(that is, the length of the input is equal to the maximum), the onKeyPress event will return the last character in the input.
React Native version:
0.63.3
Steps To Reproduce
- Create a TextInput component with maxLength=1, and an onKeyPress handler
- Type multiple different characters into the TextInput
- Observe that event.nativeEvent.key in the onKeyPress callback is always the first character that was entered into the TextInput
Expected Results
onKeyPress should return the key that was actually pressed.
This behaviour only happens in Android, and can be seen in the following snack: https://snack.expo.io/PuyXgucEf
@javiercsd Thank you for the issue! I noticed the issue in your snack - kinda annoying. Labeled it as a bug for people to check out.
Hi!
same issue here on 2023
not resolved yet?
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
The same issue 2024