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
- Enter several paragraphs with blank lines between them:
First line
Second line
Third line
- Tap the cursor in the middle paragraph.
- 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?
iOS:
KeyboardAwareScrollViewjumps to top when inserting blank lines in a parent-scrolled multilineTextInputI’m using:
with Expo SDK 54.
My screen uses an editor-style layout: a parent
KeyboardAwareScrollViewowns scrolling, while the multilineTextInputexpands with its content and has scrolling disabled.Steps to reproduce
Actual behavior
On iOS, inserting blank lines in the middle of the text can cause the parent
KeyboardAwareScrollViewto 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.7This seems to occur specifically when:
TextInputis multiline;scrollEnabled={false}is set on the input;KeyboardAwareScrollView;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 theTextInput, owns scrolling?