Setting the value of a controlled TextInput breaks when autocorrect suggestion present
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 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
- Start the reproducer: https://snack.expo.dev/@mhoran/trusting-peanut
- Type "Yo mh" and wait for the auto-correct suggestion of "my"
- Click "Bananas!"
- 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:
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 Snack 复现示例以及涉及 setState、value 属性、多行输入和 iOS 自动更正的 React Native TextInput 行为入手。在 iOS 设备上复现该问题,并将结果值与预期的 "Yo mhoran" 进行比较;完成的标准是程序化更新不再与待处理的自动更正建议合并。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, react-native
- 领域
- mobile-dev
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100