Skip to content
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

Start method is not working inside useEffect . #47

Open
ForamPattha opened this issue Apr 8, 2021 · 5 comments
Open

Start method is not working inside useEffect . #47

ForamPattha opened this issue Apr 8, 2021 · 5 comments

Comments

@ForamPattha
Copy link

ForamPattha commented Apr 8, 2021

I want to call tourguide after api calling is completed in dashboard . so I called start() inside my function . but it return with error : TypeError: start is not a function. (In 'start()', 'start' is undefined) . I'm using react native with typescript. Also When first time screen loaded mask position is not set for 1st zone .
even I just call start() like this is also not working :
useEffect(() => {
start?.(1)
}, [])
but it doesn't work .

@ForamPattha ForamPattha changed the title Start method is not working inside function . Getting error TypeError: start is not a function. (In 'start()', 'start' is undefined) Start method is not working inside useEffect . Apr 8, 2021
@moh3n9595
Copy link

moh3n9595 commented May 25, 2021

Same issue, canStart is always false and never changed.
But startAtMount works properly!

@moh3n9595
Copy link

Solution:
TourGuideProvider and start() should not be at the same level!

@farhan-ibrahim
Copy link

try

useEffect(() => {
   if(canStart) {
        start && start();
   }
},[canStart])

@bucketclan
Copy link
Contributor

This seems to work on the latest version. The example app does the same.

@anniewey
Copy link

anniewey commented Mar 7, 2023

Following the example but getting missing dependency error. While including start in dependency will cause infinity loops. How to get it work?

useEffect(() => {
    if (canStart) {
      // 👈 test if you can start otherwise nothing will happen
      start();
    }
  }, [canStart]); //throwing error: React Hook useEffect has a missing dependency: 'start'. Either include it or remove the dependency array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants