TextInput onChangeText is firing at wrong time when type with Chinese input keyboard in iOS
オープン
まだ誰も着手していません。
API: Keyboard
Component: TextInput
Needs: Triage :mag:
Never gets stale
Platform: iOS
- 主要言語
- C++
- スター
- 127k
- フォーク
- 25.3k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 4
説明
Description
TextInput onChangeText is firing at wrong time. Here is the gif to show the problem.

I am typing the Chinese wording "你好" with a Chinese input keyboard in iOS.
- The char "你" is inputted by the code "人火".
- I type with the code "人火" and these two codes are highlighted in grey in the textbox. The input method is still not completed yet. The code "人火" should not be considered as a text change event. However, onChangeText is triggered.

- After I select the char "你" in Chinese input keyboard, onChangeText is triggered twice.

React Native version:
System:
OS: macOS 11.0.1
CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
Memory: 751.11 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.1 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.8 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
Android SDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.2/12B45b - /usr/bin/xcodebuild
Languages:
Java: Not Found
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Open https://snack.expo.io/@hkhermanho/textinput-with-chinese
- Type any Chinese characters with Chinese input method
Expected Results
onChangeText should not be fire before the input method is done. It should be fired 2 times for 2 Chinese characters instead of 8 times.

Snack, code example, screenshot, or link to a repository:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンクされた Expo Snack の問題を、中国語入力メソッドを使用して iOS で再現します。説明されている入力シーケンス中に TextInput がコンポジションをどのように処理し、onChangeText がいつ発火するかを追跡します。コンポジションの完了後にのみ callbacks が発生し、中国語の 2 文字に対して 2 回発火すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- ios, react-native
- 領域
- mobile
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100