rn-tourguide icon indicating copy to clipboard operation
rn-tourguide copied to clipboard

Maximum update depth exceeded

Open SikoraKam opened this issue 3 years ago • 10 comments

I use react-native-navigation so I have to keep multiple Providers, one for each screen with tour. So far I implemented tour for two screens and everything was fine. But on third screen, using useTourGuideController() causes error "Maximum update depth exceeded...". When I tried to debug I saw that functions stop and start cause rerenders. Did anybody has similar problem?

SikoraKam avatar Sep 24 '21 13:09 SikoraKam

same i am facing

mcanikhilprajapati avatar Dec 17 '21 10:12 mcanikhilprajapati

try to add context on top of all function

mcanikhilprajapati avatar Dec 21 '21 08:12 mcanikhilprajapati

@mcanikhilprajapati can you provide some code for this ?

sarath40158 avatar Aug 24 '22 18:08 sarath40158

try to add context on top of all function

Have same problem, could you please share more info?

HaiyangZhang1994 avatar Aug 31 '22 09:08 HaiyangZhang1994

Any one having same issue 👍 I have fixed this by moving <TourGuideProvider> from top level to Other Entry File of the App flow

Just try by changing from top level to <TourGuideProvider> to wrapping up to any of entry file Like

  • Home Screen or IntroScreen or LoginScreen

sarath40158 avatar Sep 22 '22 19:09 sarath40158

Hello i have same problem, pls if someone can help me, add on Discord: Alpha Tica#7499, and help me to fix my app, i have short deadline.. tnx in advance

alphacodedev99 avatar Oct 04 '22 19:10 alphacodedev99

I was also having the same issue. I had to use TourGuideZoneByPosition in place of TourGuideZone. I'd recommend using Dimensions to find the exact position of the tour overlay.

Use the TourGuideZoneByPosition after importing like this

const { canStart, start, stop, eventEmitter, TourGuideZoneByPosition, tourKey, } = useTourGuideController();

And not import { TourGuideZoneByPosition, useTourGuideController, } from 'rn-tourguide';

surbhitrao avatar Oct 17 '22 06:10 surbhitrao

Having the same issue trying to set a guided tour on an element in a TopNavigator element, the lib was working so perfectly everywhere else :( Even with TourGuideZoneByPosition it fails as soon as i add the prop isTourGuide with the same error

renatomserra avatar Oct 21 '22 20:10 renatomserra

Thats because start exported from the hook is unstable. Its changing after every render. When eslint complains that it needs to be part of the useEffect dependency array, just ignore this warning. The dependency array must only contain canStart like the example code shows. It started to work flawlessly then.

  // this works
 React.useEffect(() => {
    canStart && start()
  }, [canStart])

  // This makes eslint happy but causes infinite render loops
 React.useEffect(() => {
    canstart && start()
  }, [canStart, start])

I am still suspicious of libs that don't export stable functions from their hooks what other re-render problems they may cause. @xcarpentier any idea why the function is not stable?

pke avatar Oct 26 '22 17:10 pke

facing the same issue. none of the comments above could solve my issue. any suggestions?

tcagkansokmen avatar Mar 24 '24 08:03 tcagkansokmen