Describe the bug
KeyboardAvoidingView with behavior="height" produces incorrect layout when navigating through a stack of screens with auto-focused inputs.
Code snippet
<KeyboardAvoidingView
behavior="height" // important
keyboardVerticalOffset={100}
style={styles.content}
>
<TextInput
autoFocus // important
placeholder="Username"
placeholderTextColor="#7C7C7C"
style={styles.textInput}
/>
<TouchableOpacity onPress={() => {
navigation.navigate(ScreenNames.KEYBOARD_AVOIDING_VIEW_COPY)
}}>
<Text>Submit</Text>
</TouchableOpacity>
To Reproduce
- Duplicate the example
KeyboardAvoidingViewExample screen (e.g. KeyboardAvoidingViewExampleCopy) and place it in the same stack.
- Add
autoFocus to the top <TextInput /> on both screens.
- Hardcode behavior="height" for
<KeyboardAvoidingView /> on both screens.
- Add stack navigation: navigate from
KeyboardAvoidingViewExample screen to KeyboardAvoidingViewExampleCopy.
- Navigate to
KeyboardAvoidingViewExample, and while having focused TextInput, navigate to KeyboardAvoidingViewExampleCopy
Note, that when I navigate to KeyboardAvoidingViewExampleCopy with blurred <TextInput /> on KeyboardAvoidingViewExample, it works fine
Expected behavior
Layout of KeyboardAvoidingViewExampleCopy is the same as for KeyboardAvoidingViewExample
Screenshots

Smartphone (please complete the following information):
- Device: Galaxy A13
- OS: Android 14
- RN version: 0.77.1
- RN architecture: old
- JS engine: Hermes
- Library version: 1.17.1
Describe the bug
KeyboardAvoidingViewwith behavior="height" produces incorrect layout when navigating through a stack of screens with auto-focused inputs.Code snippet
To Reproduce
KeyboardAvoidingViewExamplescreen (e.g.KeyboardAvoidingViewExampleCopy) and place it in the same stack.autoFocusto the top<TextInput />on both screens.<KeyboardAvoidingView />on both screens.KeyboardAvoidingViewExamplescreen toKeyboardAvoidingViewExampleCopy.KeyboardAvoidingViewExample, and while having focused TextInput, navigate toKeyboardAvoidingViewExampleCopyNote, that when I navigate to
KeyboardAvoidingViewExampleCopywith blurred<TextInput />onKeyboardAvoidingViewExample, it works fineExpected behavior
Layout of
KeyboardAvoidingViewExampleCopyis the same as forKeyboardAvoidingViewExampleScreenshots

Smartphone (please complete the following information):