How to use the react-joyride.EVENTS.TOOLTIP_CLOSE function in react-joyride

To help you get started, we’ve selected a few react-joyride 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 datavized / twotone / src / components / Tour.js View on Github external
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)
			});