React Native 0.11+ Keyboard Display Events

— 1 minute read

In React Native 0.11.0-rc we no longer need a package like react-native-keyboardevents we can simply use:

import { DeviceEventEmitter } from "react-native";

DeviceEventEmitter.addListener("keyboardWillShow", (e) => {
// Use e.endCoordinates.height
// to set your view's marginBottom
// ...
});

DeviceEventEmitter.addListener("keyboardWillHide", (e) => {
// ...
});