reactour icon indicating copy to clipboard operation
reactour copied to clipboard

[Question] Mask auto move in tour mode

Open warstrolo opened this issue 2 years ago • 2 comments

Hey, Firstly thanks for your work it's amazing ! But I have a problem when I implemented the tour mode, by default the mask don't move when user scroll Is there a simple way to implement that using the current code of the lib or do I need to make something on my

If this does not exist atm, it can be nice if we had just a option to change to have this behavior

Awaiting your reply & Best Regards, Paul Millet

warstrolo avatar May 05 '22 16:05 warstrolo

You can use the mutationObservables property (add it to each step) to trigger the Mask to recompute its position.

// steps
const steps = [
  {
    selector: ".some-element",
    mutationObservables: [`[data-tour-id="mask-position-recompute"]`]
  }
]

// Some component that sits as a child of the TourProvider.
// Change 'id' whenever you want the mask for the step to recompute its position.
const [id, setId] = React.useState("")
return <span key={id} data-tour-id="mask-position-recompute" />

R-Bower avatar Jun 08 '22 01:06 R-Bower

Thanks :)

Checking this now !

warstrolo avatar Jun 14 '22 16:06 warstrolo