TextInput onKeyPress fires after the onChange
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.3k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 4
Descripción
Description
According to the docs the keyPress event should fire before the change event. That does not seem to be the case though, I've run into this on a physical device in a project (doesn't use expo) I can't share and also reproduced this on a online playground for react native with expo.
In the video you can see that the console.log in the onChange callback happens before the cosnole.log in the onKeyPress callback:
https://github.com/user-attachments/assets/6e5b8cd5-6452-42a7-b315-54c911933a14
Steps to reproduce
- Add the onKeyPress and onChange callbacks to a TextInput
- Trigger both events by pressing any key on a keyboard
- see that onChange triggers first
React Native Version
tested on 0.74.5 and 0.76.6
Affected Platforms
Runtime - Android
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: Linux 5.10 Manjaro Linux
CPU: (8) x64 Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
Memory: 18.82 GB / 30.99 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.18.2
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 9.8.1
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: AI-241.18034.62.2411.12169540
Languages:
Java: Not Found
Ruby:
version: 2.6.8
path: /home/owner/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.74.5
wanted: 0.74.5
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: false
newArchEnabled: false
Stacktrace or Logs
no logs to show
Reproducer
https://snack.expo.dev/@ncpa/rn-bug
Screenshots and Videos
No response
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el reproductor Snack enlazado y la documentación de React Native TextInput, centrándote en el orden de onKeyPress y onChange en Android. Sigue la ruta de eventos relevante de TextInput y añade o actualiza una prueba de regresión si el repositorio tiene una; se considera terminado cuando el orden observado en Android coincide con el comportamiento documentado o la documentación refleja correctamente la implementación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- react-native
- Área
- mobile
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100