@onurkantar/react-native-key-event-listener
v0.1.6
Published
test
Downloads
27
Readme
react-native-key-event-listener
handles the external inputs
Installation
npm install react-native-key-event-listener
Usage
import { KeyEvent } from "react-native-key-event-listener";
// ...
componentDidMount() {
// if you want to react to keyDown
KeyEvent.onKeyDownListener((keyEvent) => {
console.log(`onKeyDown keyCode: ${keyEvent.keyCode}`);
console.log(`Action: ${keyEvent.action}`);
console.log(`Key: ${keyEvent.pressedKey}`);
});
}
componentWillUnmount() {
// if you are listening to keyDown
KeyEvent.removeKeyDownListener();
}
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library