prscX / react-native-app-tour

React Native: Native App Tour Library
Apache License 2.0
640 stars 119 forks source link

Callback function after circle press #86

Closed pedromartins-tk closed 4 years ago

pedromartins-tk commented 4 years ago

I need to execute an action after the user presses certain tour entity. But there is no callback for any press.

prscX commented 4 years ago

@pedromartins-tk: Please refer below snippet to achieve the callback:

  registerSequenceStepEvent = () => {
    if (this.sequenceStepListener) {
      this.sequenceStepListener.remove()
    }
    this.sequenceStepListener = DeviceEventEmitter.addListener(
      'onShowSequenceStepEvent',
      (e: Event) => {
        console.log(e)
      }
    )
  }

  registerFinishSequenceEvent = () => {
    if (this.finishSequenceListener) {
      this.finishSequenceListener.remove()
    }
    this.finishSequenceListener = DeviceEventEmitter.addListener(
      'onFinishSequenceEvent',
      (e: Event) => {
        console.log(e)
      }
    )
  }

Please refer Example project for the same.

Hope this will solve your query.

Thanks </ Pranav >