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.

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

Detect shake event on Android and iOS

MIT
Latest version published 10 months ago

Package Health Score

66 / 100
Full package analysis

Similar packages