reactour icon indicating copy to clipboard operation
reactour copied to clipboard

Need delay between each step to provide time for the element to load in DOM

Open FrancisBrokering opened this issue 1 year ago • 3 comments

I'm encountering an issue where the next step in my Reactour opens before the modal for the current step has finished opening. To open the modal, I'm using the action property within the StepType. Is there a workaround to prevent the next step from opening until the modal is fully open? https://user-images.githubusercontent.com/43657864/236607769-22fbfe99-05ce-4c23-ace9-5a768e96f368.mov

FrancisBrokering avatar May 06 '23 06:05 FrancisBrokering

any help?

FrancisBrokering avatar May 24 '23 23:05 FrancisBrokering

@FrancisBrokering You can try doing something like this:

  const [step, setStep] = useState(0);
  const setCurrentStep = (step) => {
    setTimeout(() => {
      setStep(step);
    }, 1000); <-- YOUR DELAY
  };

<TourProvider steps={steps} setCurrentStep={setCurrentStep} currentStep={step}>
       <Router />
</TourProvider>

Basically you highjack the setting of the current step and delay the change.

ConstantinChirila avatar May 26 '23 13:05 ConstantinChirila

Try using this prop: 'inViewThreshold'.

usamamajid6 avatar Feb 21 '24 03:02 usamamajid6