rn-tourguide
rn-tourguide copied to clipboard
Maximum update depth exceeded
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?
same i am facing
try to add context on top of all function
@mcanikhilprajapati can you provide some code for this ?
try to add context on top of all function
Have same problem, could you please share more info?
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
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
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';
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
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?
facing the same issue. none of the comments above could solve my issue. any suggestions?