React-joyride: [V2] Click on the close button activate next step

Created on 10 May 2018  路  6Comments  路  Source: gilbarbara/react-joyride

There are strange behavior in react-joyride V2.

Expected behavior
When I click on the close button at the step, I expect the tour to stop.

Actual behavior
This does not happen, instead the next step is turned on

Steps to reproduce the problem
Open demo and Basic example. Click on the 'Let's go' to start guide and the click on the close button (cross).

React version
16.3.2

React-Joyride version
2.0.0-8

Error stack

If you are having UI issues, make sure to send a public URL or codesandbox example.

Most helpful comment

@lbelavoir yes, you are asking the step to NOT show the beacon, so it will open the tooltip automatically.
If you want to control the behavior of the close button, you need to use manage the lifecycle yourself with callback and stepIndex

All 6 comments

Same behaviour in React-Joyride 2.0.0-11

@lbelavoir In my case Tutorial is closed in the callback via handler like this:

handleJoyrideCallback = data => {
    const { action, index, type, size } = data;

    if (action === ACTIONS.CLOSE && this.state.run) {
      return closeTutorial({ name });
    } 
  }

On the basic demo, the second step had disableBeacon set to true, so it wouldn't show the beacon when closing the first step.
If you don't use the disableBeacon prop, it would close the current step and stop at the next beacon.

@gilbarbara I'm using disableBeacon on every step I have and each time I click on close, it closes the step and always shows the next step.

@lbelavoir yes, you are asking the step to NOT show the beacon, so it will open the tooltip automatically.
If you want to control the behavior of the close button, you need to use manage the lifecycle yourself with callback and stepIndex

Ran into the same problem. Solved it like this:

handleGuideCallback = (data: CallBackProps) => {
    const {  action } = data;
    const finishedStatuses: string[] = [STATUS.FINISHED, STATUS.SKIPPED];

    if (finishedStatuses.includes(status) || action == 'close') {
      this.setState({run:false})
    }
  };

This handles if user clicks the close button or clicks outside of the step. Hope this helps!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yaskor picture yaskor  路  6Comments

kAleksei picture kAleksei  路  5Comments

willgriff0826 picture willgriff0826  路  6Comments

snlhnk picture snlhnk  路  5Comments

jjordy picture jjordy  路  3Comments