react-native-recipes icon indicating copy to clipboard operation
react-native-recipes copied to clipboard

Example of adjusting views along on-screen keyboard

Open grabbou opened this issue 10 years ago • 3 comments

Hiding certain elements so keyboard does not covers inputs etc.

grabbou avatar Sep 14 '15 18:09 grabbou

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>

browniefed avatar Sep 14 '15 21:09 browniefed

+1, or with Animated as per my Slack gist :)

grabbou avatar Sep 14 '15 21:09 grabbou

Don't forget to remove the listener when you don't need it anymore!

browniefed avatar Nov 04 '15 17:11 browniefed