My layout is a ScrollView above a footer. When the keyboard isnt open I need the footer to always be visible on the screen:
https://snack.expo.io/@jamesweblondon/privileged-cashew1
export default function App() {
return (
<SafeAreaView style={styles.container}>
<ScrollView style={styles.content}>
<TextInput style={styles.input} value={"Text Input"} />
</ScrollView>
<View style={styles.footer}>
<Text>Footer</Text>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
content: {
backgroundColor: "tomato",
padding: 50,
},
input: {
backgroundColor: "grey",
padding: 50,
},
footer: {
backgroundColor: "green",
padding: 50,
},
});
This works great on iOS. When the keyboard opens you no longer see the footer:

However on Android the footer moves above the keyboard:
Can I stop this behaviour? Ive tried using Keyboard events however keyboardWillShow and keyboardWillHide arn't supported on Android. If I use keyboardDidShow and keyboardDidHide then the delay means the footer is visible as the keyboard animates up and then disappears, which feels jerky and unpleasant.
export default function App() {
const [keyboardIsOpen, setKeyboardIsOpen] = React.useState(false);
Keyboard.addListener("keyboardDidShow", () => {
setKeyboardIsOpen(true);
});
Keyboard.addListener("keyboardDidHide", () => {
setKeyboardIsOpen(false);
});
return (
<SafeAreaView style={styles.container}>
<ScrollView style={styles.content}>
<TextInput style={styles.input} value={"Text Input"} />
</ScrollView>
{!keyboardIsOpen && (
<View style={styles.footer}>
<Text>Footer</Text>
</View>
)}
</SafeAreaView>
);
}
I also couldn't get it working with the KeyboardAvoidingView. I'm using Expo.

