How to use the react-native-shake.addEventListener function in react-native-shake

To help you get started, we’ve selected a few react-native-shake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github textileio / notes / src / Containers / Home.tsx View on Github external
componentWillMount() {
    RNShake.addEventListener('ShakeEvent', () => {
      if (this.state.note !== '') {
        Alert.alert(
          'Create disappearing IPFS note',
          'Cannot be undone.',
          [
            {
              text: 'Cancel',
              style: 'cancel'
            },
            {text: 'Confirm', onPress: () => {
              this.props.publicNote(this.state.note)
            }}
          ],
          {cancelable: true}
        )
      }
github LiskHQ / lisk-mobile / src / components / shared / transactions / index.js View on Github external
componentDidMount() {
    let timeout = null;
    if (this.props.type === 'home') {
      RNShake.addEventListener('ShakeEvent', () => {
        if (!timeout) {
          this.props.settingsUpdated({
            incognito: !this.props.incognitoMode,
          });
          timeout = setTimeout(() => {
            timeout = false;
          }, 1000);
        }
      });
    }
    this.initialFadeIn();
  }
  componentWillUnmount() {//eslint-disable-line
github MetaMask / metamask-mobile / app / core / Feedback.js View on Github external
constructor({ maxDelay, eventsRequired, action }) {
		this.count = 0;
		this.timer = null;
		this.maxDelay = maxDelay || 4000;
		this.action = action;
		this.eventsRequired = eventsRequired || 2;
		RNShake.addEventListener('ShakeEvent', this.onShake);
	}

react-native-shake

React Native shake event detector

MIT
Latest version published 20 days ago

Package Health Score

86 / 100
Full package analysis