react / react/react-native

Setting the value of a controlled TextInput breaks when autocorrect suggestion present

オープン
#27,019 コメント 21 件 リアクション 6 件 担当者 0 名 GitHub で見る

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

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

説明

On iOS, something wonky happens when the value of a TextInput is programmatically modified (via setState and the value property of said TextInput) and an autocorrect suggestion is present.

The value of the text input ends up being set to the combination of the autocorrect suggestion and the programmatic value. This only happens when multiline={true}. When multiline={false}, all is fine.

This seems only to be reproducible on iOS. I was not able to reproduce on the Snack iOS simulator. This can be reproduced using the software keyboard in the Snack iOS simulator with multiline={true}. The Snack iOS simulator does not reproduce with multiline={false}, but this does reproduce on a device.

React Native version: 0.59-0.76

Steps To Reproduce

  1. Start the reproducer: https://snack.expo.dev/@mhoran/trusting-peanut
  2. Type "Yo mh" and wait for the auto-correct suggestion of "my"
  3. Click "Bananas!"
  4. Notice that the value set programmatically will become a combination of the autocorrect value and the programmatic value.

Describe what you expected to happen:

I expected the value to be set to "Yo mhoran".

Snack, code example, screenshot, or link to a repository:

https://snack.expo.dev/@mhoran/trusting-peanut

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

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

はじめの一歩

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

調査の方向性

リンクされた Snack の再現例と、setState、value プロパティ、複数行入力、iOS の自動修正に関係する React Native TextInput の動作から始めます。iOS デバイスで問題を再現し、結果の値を期待される "Yo mhoran" と比較します。プログラムによる更新が保留中の自動修正候補と結合されなくなれば完了です。

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

評価

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

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

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