Skip to content

steliyan/react-native-shake-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-shake-event

npm npm react-native channel on discord

Add the shake event on your React Native mobile app, giving to users improved usability. Enjoy!

Demo

react-native-shake-event

Install

$ npm install react-native-shake-event --save
Link (required)

react-native link react-native-shake-event

Link (iOS manually)
  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.

Usage

import RNShakeEvent from 'react-native-shake-event';

class App extends React.Component {
  componentDidMount() {    
    RNShakeEvent.onEnded(() => {
      console.debug('Device shaked.');
    });
  }

  componentWillUnmount() {
    RNShakeEvent.remove();
  }
}

API

RNShakeEvent

onBegan(Function?)

Start listening the shake event and handle a callback function "on began".

onEnded(Function?)

Start listening the shake event and handle a callback function "on ended".

remove(Function?)

Stop to listening the shake event, recommended to prevent memory leak.

Issues

  1. On debug mode this event also handle the DevMenu.
  2. Submit here.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published