This component is a shortcut to listen to the keyboard when the component mounts.
Should work for React-Native 0.27+.
npm install --save react-native-keyboard-listener
Import the component into the file you want to use it:
import KeyboardListener from 'react-native-keyboard-listener';
Use the component directly in your code. The component won't render anything
<View>
<KeyboardListener
onWillShow={() => { this.setState({ keyboardOpen: true }); }}
onWillHide={() => { this.setState({ keyboardOpen: false }); }}
/>
</View>
onWillShow()
onWillHide()
onDidShow()
onDidHide()
onWillChangeFrame()
onDidChangeFrame()
MIT