react / react/react-native

iOS: Multiline TextInput onKeyPress event handler unexpectedly receives a Backspace event

Abierto
#37,967 22 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Component: TextInput Needs: Attention Needs: Triage :mag: Platform: iOS
Lenguaje dominante
C++
Estrellas
127k
Forks
25.3k
Merge medio
1 d 23 h
PR fusionados (30 d)
4

Descripción

Description

The TextInput onKeyPress event handler receives an unexpected Backspace event when multiline is true. The exact behavior varies between iOS 15 and iOS 16:

  • iOS 15: The Backspace event is received after value is reset to an empty string
  • iOS 16: The Backspace event is received on EVERY change AND when value is reset to an empty string

This has been tested on iOS 15.5, 16.4, and 16.5.

Possibly related: https://github.com/facebook/react-native/issues/34891

React Native Version

0.71.11

Output of npx react-native info

System:
OS: macOS 13.4
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 27.38 GB / 64.00 GB
Shell: 5.9 - /usr/local/bin/zsh
Binaries:
Node: 18.16.0 - ~/.asdf/installs/nodejs/18.16.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.6.6 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: Not Found
Managers:
CocoaPods: 1.12.1 - /Users/jeff/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.10121639
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
Languages:
Java: 11.0.13 - /Users/jeff/.asdf/shims/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.11 => 0.71.11
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce
  1. Add a <TextInput multiline /> component and log all events received by onKeyPress
  2. Type into the input
  3. Observe that an event with nativeEvent.key set to 'Backspace' is received after every onKeyPress event is received for the typed key
Snack, code example, screenshot, or link to a repository

https://github.com/jbrowning/RN071TextInputBackspace

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la reproducción vinculada RN071TextInputBackspace e inspecciona la ruta del evento TextInput onKeyPress en iOS, comparando el comportamiento multiline en iOS 15 y 16. Se considera terminado cuando escribir y restablecer el valor ya no produce eventos Backspace espurios, mientras los eventos de teclado genuinos se mantienen.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
ios, 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
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.