TextInput onKeyPress fires after the onChange
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Snack の再現コードと React Native TextInput のドキュメントから始め、Android における onKeyPress と onChange の順序に注目してください。TextInput に関連するイベントパスを追跡し、リポジトリに回帰テストがある場合はそれを追加または更新してください。観測された Android の順序がドキュメントに記載された動作と一致するか、ドキュメントが実装を正確に反映していれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- react-native
- 領域
- mobile
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100