react-native-keycommands
Use UIKeyCommands
(iOS).
Getting started
$ npm install react-native-keycommands --save
Mostly automatic installation (RN < 0.60)
$ react-native link react-native-keycommands
Manual installation (RN < 0.60)
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-keycommands
and addKeyCommands.xcodeproj
- In XCode, in the project navigator, select your project. Add
libKeyCommands.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
Not need setup.
Usage
;; const keyCommands = input: 'a' modifierFlags: 0 // without flags discoverabilityTitle: 'a pressed' input: 'a' modifierFlags: constantskeyModifierCommand discoverabilityTitle: 'CMD + a pressed' input: 'a' modifierFlags: constantskeyModifierCommand | constantskeyModifierAlternate discoverabilityTitle: 'CMD + ALTERNATE + a pressed' ; Component { console; }; { <KeyCommands style= flex: 1 keyCommands=keyCommands onKeyCommand=thisonKeyCommand /> };