Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleJoyrideCallback = tour => {
const { action, index, type } = tour;
if (type === EVENTS.TOUR_END || action === EVENTS.TOOLTIP_CLOSE || type === EVENTS.STEP_AFTER && index >= lastStepIndex) {
logEvent('tour', index >= lastStepIndex ? 'complete' : 'skip', index);
// Update user preferences with completed tour flag
this.setState({
stepIndex: 0,
run: false
});
this.props.setConfig({
showTour: false
});
} else if (type === EVENTS.STEP_AFTER) {
// Since this is a controlled tour you'll need to update the state to advance the tour
this.setState({
stepIndex: index + (action === ACTIONS.PREV ? -1 : 1)
});