Skip to main content
Version: 1.12.0

KeyboardEvents

This library exposes 4 events which are available on all platforms:

  • keyboardWillShow
  • keyboardWillHide
  • keyboardDidShow
  • keyboardDidHide

Event structure​

All events have following properties:

type KeyboardEventData = {
height: number; // height of the keyboard
duration: number; // duration of the animation
timestamp: number; // timestamp of the event from native thread
target: number; // tag of the focused TextInput
};

Example​

import { KeyboardEvents } from "react-native-keyboard-controller";

useEffect(() => {
const show = KeyboardEvents.addListener("keyboardWillShow", (e) => {
// place your code here
});

return () => {
show.remove();
};
}, []);

Also have a look on example app for more comprehensive usage.