Skip to content
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

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

Closed
javiercsd opened this issue Jan 15, 2021 · 5 comments
Labels
Bug Component: TextInput Related to the TextInput component. Impact: Platform Disparity Platform: Android Android applications. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@javiercsd
Copy link

javiercsd commented Jan 15, 2021

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

@safaiyeh safaiyeh added Component: TextInput Related to the TextInput component. Bug and removed Needs: Triage 🔍 labels Jan 16, 2021
@safaiyeh
Copy link
Contributor

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

@sbueno-bemobile
Copy link

Hi!

same issue here on 2023

not resolved yet?

Copy link

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 github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 20, 2024
Copy link

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

@veliseev93
Copy link

The same issue 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Component: TextInput Related to the TextInput component. Impact: Platform Disparity Platform: Android Android applications. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
4 participants