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

TextInput OnChangeText event fires before OnKeyPress #26290

Closed
srilalitharanikintali opened this issue Sep 1, 2019 · 3 comments
Closed

TextInput OnChangeText event fires before OnKeyPress #26290

srilalitharanikintali opened this issue Sep 1, 2019 · 3 comments
Labels
Bug Component: TextInput Related to the TextInput component. Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@srilalitharanikintali
Copy link

srilalitharanikintali commented Sep 1, 2019

When using onKeyPress event and onChangeText event in TextInput I have a use case where I am updating the state value in onChangeText but I need the previous state value for my onKeyPress event but it happens to be that onChangeText is first updating the state value and then onKeyPress is receiving the updated value
Documentation Link: https://facebook.github.io/react-native/docs/textinput#onkeypress

React Native version:

System:
OS: Linux 4.15 Ubuntu 18.04 LTS (Bionic Beaver)
CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
Memory: 237.38 MB / 15.53 GB
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 10.16.1 - ~/.nvm/versions/node/v10.16.1/bin/node
Yarn: 1.17.3 - /usr/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.1/bin/npm
SDKs:
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.0
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1

Steps To Reproduce

  1. clone the repository
  2. run the app
  3. use the remote debugger and check in the console

Given Input: abc
onKeyPress is fired with backspace there the expected state value is abc

Repository link: https://github.com/srilalitharanikintali/onKeyPressIssue

@react-native-bot react-native-bot added Component: TextInput Related to the TextInput component. Platform: Linux Building on Linux. labels Sep 1, 2019
@tellodaniel
Copy link

+1

@stale
Copy link

stale bot commented Jan 30, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 30, 2020
@stale
Copy link

stale bot commented Feb 6, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Feb 6, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: TextInput Related to the TextInput component. Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants