-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autostart on mount #287
Comments
I had similar issue but was able to fix it, Here is my solution const { currentStepNumber } = useCopilot()
const isMounted = useIsMounted();
useEffect(() => {
const timeout = setTimeout(() => {
if (isMounted.current && currentStepNumber === 0) {
start();
}
}, TIMEOUT);
return () => clearTimeout(timeout);
}, [currentStepNumber, isMounted, start]);
you can search for |
The fix @lurdharry mentions does not work here. Any update would be greatly appreciated. |
@Saigronas try replacing the useEffect hook with useFocusEffect hook from react navigation. It was working well when I used useEffect but it stopped working at some point may be due to metro bundler cache issue, but since I changed to useFocusEffect , it has been working perfectly even in production. |
Even by using useFocusEffect, (which i already used for another reason), i cannot get the tour to start on its own or by navigating to the screen. However, when pressing "ctrl+s" and thereby refreshing the app, the tour starts. |
@Saigronas did you get any solution? |
any update on the issue? |
I encountered an issue where the code wasn't functioning within the <View onLayout={() => start()}> |
@Saigronas did you get any solution? |
same problem here, the start() doesn't work if it is called inside of a useEffect |
Thanks for the inspiration @work4m. This worked like magic, it even worked with scrollview
|
<View onLayout={() => runTutorial()}> |
Whenever i try to start the tour from useEffect, It does'nt work even if am passing setTimeout to it. Example code is given below:
const tour = useCopilot()
useEffect(()=>{
setTimeout(()=>{
tour.start("repaircat");
}, 600)
},[])
In the first screen I have started the tour by passing start() to the button click but in the second screen i want to initiate the tour again by calling start with the name of step through useEffect.
Is there any way to start the tour without clicking any button?
The text was updated successfully, but these errors were encountered: