react-native-recipes
react-native-recipes copied to clipboard
Example of adjusting views along on-screen keyboard
Hiding certain elements so keyboard does not covers inputs etc.
DeviceEventEmitter.addListener('keyboardWillShow', function (frames) {
LayoutAnimation.configureNext(LayoutAnimation.create(frames.duration, 'keyboard'));
this.setState({keyboardSpace: frames.endCoordinates.height});
}.bind(this));
<View style={{height: this.state.keyboardSpace}}></View>
+1, or with Animated as per my Slack gist :)
Don't forget to remove the listener when you don't need it anymore!