When navigate to new screen it's append to current screen on react-navigation 6

Viewed 43
1 Answers

Your <Home/> route is at '/' path, and every other path ( /about, /details... ) will match the '/' path.


That is why <Home/> is on every other page you visit.


You can try to pass EXACT prop:

             <Sky.Screen
                    exact
                    key={index}
                    name={route.name}
                    component={route.screen}
                    initialParams={route.initialParams}
                    options={route.options}
              />

Then, React Router, instead of checking componentCnfiguredPath.includes(currentPath) ? <ComponentConfigured/> : null

will check if componentCnfiguredPath====currentPath ? <ComponentConfigured/> : null

Related