Add the shake event on your React Native app, giving to users improved usability. Enjoy! (works only on real device)
Demo
Install
$ npm install react-native-shake-event --save
iOS
Automatic
react-native link react-native-shake-event
Manual
- Add the
ios/RNShakeEvent.xcodeproj
file to your Xcode project Demo; - Add the
Products/libRNShakeEvent.a
file to Build Phases Demo.
This step is described here: Linking Libraries.
Android
react-native link react-native-shake-event
Usage
; Component { RNShakeEvent; } { RNShakeEvent; }
API
RNShakeEvent
addEventListener('shake', Function)
Start listening the shake event and handle a callback function.
removeEventListener('shake', Function)
Stop to listening the shake event, and is recommended to prevent memory leak.
Issues
- On debug mode this event also handle the DevMenu, but works fine on production.
- Submit here.
License
MIT