我正在react-native中创建一个嵌套的导航容器,堆栈看起来像这样:
-主导航容器: -主页 -市场导航容器: -市场 -购物车 -关于
当我回家或大约回去时,它可以正常工作。但是,当我从市场或购物车返回时(我希望返回首页),它显示一条错误消息:
The action 'POP' with payload {"count":1} was not handled by any navigator.
Is there any screen to go back to?
This is a development-only warning and won't be shown in production.
这是我的主导航容器代码:
<NavigationContainer independent={true}>
<Stack.Navigator>
<Stack.Screen options={myOptions} name="Home" component={Home} />
<Stack.Screen
options={{ headerShown: false }}
name="MarketNavigation"
component={MarketNavigation}
/>
<Stack.Screen options={myOptions} name="About" component={About} />
</Stack.Navigator>
</NavigationContainer>
这是我的市场导航代码:
<NavigationContainer ref={navigationRef} independent={true}>
<Stack.Navigator>
<Stack.Screen
options={myOptions}
name="Market"
component={Market}
/>
<Stack.Screen
options={myOptions}
name="Cart"
component={Cart}
/>
</Stack.Navigator>
</NavigationContainer>
答案 0 :(得分:0)
您可以添加从首页导航到MarketNavigation并返回的代码吗?