react / react/react-native

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

オープン
#37,967 コメント 22 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Component: TextInput Needs: Attention Needs: Triage :mag: Platform: iOS
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされたRN071TextInputBackspaceの再現から始め、iOS上のTextInput onKeyPressイベントパスを調査し、iOS 15と16でmultilineの動作を比較します。値の入力とリセットによって不要なBackspaceイベントが発生しなくなり、実際のキーイベントが維持されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
ios, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。