Skip to content

moveyourbuddy/react-native-shake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Shake Event Detector

(forked from https://github.com/Doko-Demo-Doa/react-native-shake)

With this library, you can add shake event detector on your React Native app. Because react-native-shake-event is not in active development anymore, I decided to created this.

Please note that it only works on real devices

Installation

npm install @moveyourbuddy/react-native-shake

or

yarn add @moveyourbuddy/react-native-shake

Linking the native modules

Automatic:

react-native link @moveyourbuddy/react-native-shake

Manual (iOS):

  1. Add the ios/RNShakeEvent.xcodeproj file to your Xcode project Demo;
  2. Add the Products/libRNShakeEvent.a file to Build Phases Demo.

This step is described here: Linking Libraries.

Manual (Android):

react-native link @moveyourbuddy/react-native-shake

Usage

import RNShake from "@moveyourbuddy/react-native-shake";

class MyComponent extends React.Component {
  componentWillMount() {
    RNShake.addEventListener("ShakeEvent", () => {
      // Your code...
    });
  }

  componentWillUnmount() {
    RNShake.removeEventListener("ShakeEvent");
  }
}

About

React Native shake event detector

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 68.6%
  • Objective-C 24.0%
  • JavaScript 7.4%