react / react/react-native

[iOS] The scroll position of the multiline TextInput affects the ScrollView auto-scroll when the keyboard opens/closes

未关闭
#52,416 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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>
  1. ScrollView with automaticallyAdjustKeyboardInsets
  2. Content above the TextInput to fill the screen
  3. Multiline TextInput with fixed height and many lines of text
  4. Content below the TextInput to allow the ScrollView to scroll if needed
  5. Focus on the input and scroll it to the end
  6. Scroll the ScrollView to align the TextInput at the bottom of the screen
  7. Focus on the last line in the TextInput
  8. The keyboard slides up, and the ScrollView scrolls too much
  9. With the keyboard open, scroll the ScrollView to align the TextInput at the bottom of the screen (above the keyboard)
  10. Close the keyboard
  11. 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

https://snack.expo.dev/@serge0n/the-scroll-position-of-the-multiline-textinput-affects-the-scrollview-auto-scroll-when-the-keyboard-opens-or-closes?platform=ios

Screenshots and Videos

https://github.com/user-attachments/assets/1566ea6e-e936-4670-a18a-80090857f58c

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从必需的 iOS Snack reproducer 开始,比较打开和关闭键盘时 ScrollView 与 multiline TextInput 的行为。跟踪 automaticallyAdjustKeyboardInsets 的处理,然后验证打开键盘时 ScrollView 不再滚动过远,关闭键盘时也不会向上移动。

由索引模型根据 Issue 内容生成。

评估

技术栈
ios, react-native
领域
mobile
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。