react-native icon indicating copy to clipboard operation
react-native copied to clipboard

On Android, the onKeyPress callback returns the wrong key value when the TextInput has the maxLength property

Open javiercsd opened this issue 4 years ago • 3 comments

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

  1. Create a TextInput component with maxLength=1, and an onKeyPress handler
  2. Type multiple different characters into the TextInput
  3. 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 avatar Jan 15 '21 19:01 javiercsd

@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.

safaiyeh avatar Jan 16 '21 17:01 safaiyeh

Hi!

same issue here on 2023

not resolved yet?

sbueno-bemobile avatar Aug 23 '23 13:08 sbueno-bemobile

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.

github-actions[bot] avatar Feb 20 '24 05:02 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Feb 27 '24 05:02 github-actions[bot]

The same issue 2024

veliseev93 avatar May 03 '24 11:05 veliseev93