gilbarbara / react-joyride

Create guided tours in your apps
https://react-joyride.com/
MIT License
6.88k stars 529 forks source link

EVENTS.STEP_BEFORE when element not present in the DOM #436

Closed domos4 closed 5 years ago

domos4 commented 6 years ago

I have this use case when I want to use Joyride on element, that is not preset in the DOM until I dispatch a redux action (dropdown opens then). I wanted to pass callback prop to React-Joyride and then dispatch redux action on EVENTS.STEP_BEFORE. It is not called thou, because it checks for presence in the DOM, so my hands are tied.

I can do a PR to fix this, but don't know how. Should it be considered a bug, or maybe that is intended? If yes, I could add additional step that is called even before EVENTS.STEP_BEFORE to handle such case.

React-Joyride version 2.0.0

gilbarbara commented 5 years ago

This is the perfect case for the controlled flow with stepIndex. You can wait for your side effects to resolve before changing it by yourself.