I'm trying to make a sticky footer with the KeyboardAvoidingView
component in React Native. I'm very close to accomplishing this task, however, when they keyboard comes up, the footer is moving up but shrinking in height at the same time.
Here's what it looks like before the keyboard comes up:
And here's what it looks like after the keyboard comes up:
As you can see, the submit container is smaller than it is before there is a keyboard.
Here's my current code:
render() {
return (
<KeyboardAvoidingView style={{ flex: 1 }} behavior="padding">
<View style={{ flex: 1, }}>
<TextInput
placeholder="Username"
value={this.state.username}
style={Styles.textInput}
onChangeText={(username) => this.setState({ username })}
autoCorrect={false}
/>
<TextInput
style={Styles.textInput}
placeholder="Email"
value={this.state.email}
onChangeText={(email) => this.setState({ email })}
autoCorrect={false}
/>
</View>
<View style={{ height: 100, backgroundColor: 'blue' }}>
<Text>Submit</Text>
</View>
</KeyboardAvoidingView>
);
What am I doing wrong?