TextInput with controled selection clear children when change position
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
If you have TextInput with styled Text element inside (instead of value) and when you add controlled selection, the children are ignored and you have blank text even when you have initialValue.
Steps to reproduce
- Create TextInput with children
- Make it controlled selection Input
- Change the selection to move the cursor
- The children disappear
React Native Version
0.72.6
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: Linux 6.6 Fedora Linux 39 (Xfce)
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 4.72 GB / 15.28 GB
Shell:
version: 5.2.21
path: /bin/bash
Binaries:
Node:
version: 21.2.0
path: ~/.nvm/versions/node/v21.2.0/bin/node
Yarn: Not Found
npm:
version: 10.2.3
path: ~/.nvm/versions/node/v21.2.0/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.9
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/local/rvm/rubies/ruby-2.6.10/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.6
wanted: 0.72.6
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Sorry, I have no idea why it can't find Android Studio and SDK on my system. I have them installed, and updated recently to 2023.1.1 from November 9, 2023.
Stacktrace or Logs
There are no stacktrace with this bug
Reproducer
https://github.com/jcubic/react-native-text-input.git
Screenshots and Videos
The First Input is with children (each line has it's on <Text>) the second is with value.
The same happens when you move the cursor in the bottom Input, the top content disappears.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 jcubic/react-native-text-input 复现示例开始,使用带样式的 children 进行受控 selection,复现 Android 故障。在移动光标时,对比基于 children 的 input 与基于 value 的 input。完成标准是:selection 发生变化后,带样式的 children 仍保持可见,包括存在初始 value 的情况。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100