[iOS] The scroll position of the multiline TextInput affects the ScrollView auto-scroll when the keyboard opens/closes
未关闭
还没有人认领这个 Issue。
API: Keyboard
Component: ScrollView
Component: TextInput
Issue: Author Provided Repro
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
On iOS, when using a ScrollView with automaticallyAdjustKeyboardInsets and a multiline TextInput, the scroll position of the TextInput affects how the ScrollView auto-scrolls when the keyboard opens or closes.
Steps to reproduce
<ScrollView automaticallyAdjustKeyboardInsets>
// Any content above the TextInput to position it at the bottom of the screen
<TextInput multiline style={{ height: 100 }} /> // multiline TextInput with fixed height and many lines of text (let say 20)
// More content to allow the ScrollView to scroll if needed
</ScrollView>
- ScrollView with automaticallyAdjustKeyboardInsets
- Content above the TextInput to fill the screen
- Multiline TextInput with fixed height and many lines of text
- Content below the TextInput to allow the ScrollView to scroll if needed
- Focus on the input and scroll it to the end
- Scroll the ScrollView to align the TextInput at the bottom of the screen
- Focus on the last line in the TextInput
- The keyboard slides up, and the ScrollView scrolls too much
- With the keyboard open, scroll the ScrollView to align the TextInput at the bottom of the screen (above the keyboard)
- Close the keyboard
- The ScrollView scrolls up
React Native Version
0.79.5
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
This is not relevant
Stacktrace or Logs
This is not relevant
MANDATORY Reproducer
Screenshots and Videos
https://github.com/user-attachments/assets/1566ea6e-e936-4670-a18a-80090857f58c
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从必需的 iOS Snack reproducer 开始,比较打开和关闭键盘时 ScrollView 与 multiline TextInput 的行为。跟踪 automaticallyAdjustKeyboardInsets 的处理,然后验证打开键盘时 ScrollView 不再滚动过远,关闭键盘时也不会向上移动。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100