Skip to content

KeyboardAwareScrollView scrolls to top instead of keeping the cursor visible when inserting blank lines in a multiline TextInput #1593

Description

@xl0301

iOS: KeyboardAwareScrollView jumps to top when inserting blank lines in a parent-scrolled multiline TextInput

I’m using:

"react-native-keyboard-controller": "^1.21.7"

with Expo SDK 54.

My screen uses an editor-style layout: a parent KeyboardAwareScrollView owns scrolling, while the multiline TextInput expands with its content and has scrolling disabled.

<KeyboardAwareScrollView>
  <TextInput
    multiline
    scrollEnabled={false}
    value={text}
    onChangeText={setText}
  />
</KeyboardAwareScrollView>

Steps to reproduce

  1. Enter several paragraphs with blank lines between them:
First line


Second line


Third line
  1. Tap the cursor in the middle paragraph.
  2. Press Enter repeatedly to add blank lines at that cursor position.

Actual behavior

On iOS, inserting blank lines in the middle of the text can cause the parent KeyboardAwareScrollView to unexpectedly scroll back to the top.

The scroll position does not follow the caret, so the cursor may move off-screen while editing.

Expected behavior

The parent scroll view should preserve the current editing position and scroll only as needed to keep the caret visible. Adding lines above the caret should not reset the page to the top.

Environment

  • react-native-keyboard-controller: ^1.21.7
  • Expo SDK: 54
  • Platform: iOS only
  • Reproduced on: both physical iOS devices and iOS Simulator
  • Not observed on: Android

This seems to occur specifically when:

  • TextInput is multiline;
  • scrollEnabled={false} is set on the input;
  • scrolling is delegated entirely to the wrapping KeyboardAwareScrollView;
  • blank lines are inserted in the middle of existing text.

Is this a known limitation or issue with KeyboardAwareScrollView? Is there a recommended configuration or workaround for editor-style screens where the parent scroll view, rather than the TextInput, owns scrolling?

Metadata

Metadata

Assignees

Labels

KeyboardAwareScrollView 📜Anything related to KeyboardAwareScrollView component🍎 iOSiOS specific🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions