给定以下导航器层次结构,构建链接配置对象的正确方法是什么?按照当前的构造,当尝试打开“myapp://bizpage/1”时,出现此错误:
从 URL 解析的导航状态包含根导航器中不存在的路由。这通常意味着链接配置与导航结构不匹配。有关如何指定链接配置的更多详细信息,请参阅https://reactnavigation.org/docs/configuring-links 。
我整个晚上都按照文档攻击谷歌。我不明白我哪里出错了。
有人能指出我正确的方向吗?
function AppNav({navigation}) {
return (
<Stack.Navigator>
<Stack.Screen
name="AuthFlow"
component={AuthFlow}
/>
<Stack.Screen
name="DrawerNav"
component={DrawerNav}
/>
</Stack.Navigator>
);
}
Run Code Online (Sandbox Code Playgroud)
function AuthFlow({navigation}) {
return (
<Stack.Navigator>
<Stack.Screen
name="Login"
component={Login}
/>
<Stack.Screen
name="Signup"
component={Signup}
/>
</Stack.Navigator>
);
}
Run Code Online (Sandbox Code Playgroud)
function DrawerNav({navigation}) {
return (
<Drawer.Navigator>
<Drawer.Screen
name="Home"
component={Main}
/>
<Drawer.Screen
name="Profile"
component={Profile}
/>
<Drawer.Screen
name="Notifications"
component={NotificationsScreen}
/>
</Drawer.Navigator>
);
}
Run Code Online (Sandbox Code Playgroud)
function Main({navigation}) {
return (
<Stack.Navigator>
<Stack.Screen
name="HomeScreen"
component={HomeScreen}
/>
<Stack.Screen
name="BizPage"
component={BizPage}
/>
<Stack.Screen
name="PeerProfile"
component={PeerProfile} …Run Code Online (Sandbox Code Playgroud)