1

当我导航到新屏幕时,它会附加到同一屏幕,就像这样。网页上的反应导航 v6

在此处输入图像描述

它出什么问题了?

链接和路由 在此处输入图像描述

代码在那里,不能在那个帖子上发布代码。出错了

https://github.com/react-navigation/react-navigation/discussions/10128

4

1 回答 1

0

您的<Home/>路线位于“/”路径,其他所有路径(/about、/details...)都将匹配“/”路径。


这就是为什么<Home/>在您访问的每个其他页面上。


您可以尝试通过EXACT道具:

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

然后,反应路由器,而不是检查componentCnfiguredPath.includes(currentPath) ? <ComponentConfigured/> : null

将检查是否componentCnfiguredPath====currentPath ? <ComponentConfigured/> : null

于 2021-11-16T09:14:34.773 回答