TextInput OnChangeText event fires before OnKeyPress #26290
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.
When using
onKeyPress
event andonChangeText
event inTextInput
I have a use case where I am updating the state value inonChangeText
but I need the previous state value for myonKeyPress
event but it happens to be thatonChangeText
is first updating the state value and thenonKeyPress
is receiving the updated valueDocumentation 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
Given Input: abc
onKeyPress
is fired with backspace there the expected state value is abcRepository link: https://github.com/srilalitharanikintali/onKeyPressIssue
The text was updated successfully, but these errors were encountered: