[英]How to implement global accesed screens with bottom tab navigator
I'm developing an application whose main navigation is composed by bottom tabs , this application has some screens which need to be globally accesed from different tabs/places.我正在开发一个应用程序,其主要导航由底部选项卡组成,该应用程序有一些屏幕需要从不同的选项卡/位置全局访问。 An important thing to highlight is that from this global screen I can go back to the place from which it was accessed(go back navigation action).需要强调的重要一点是,从这个全局屏幕我可以 go 回到访问它的地方(返回导航操作)。 Here a simple UI to ilustrate the use case:这里有一个简单的用户界面来说明用例:
It's not clear to me how the distribution of the navigators must be to be able to implement this navigation architecture.我不清楚导航器的分布必须如何才能实现这种导航架构。
what you can go is Nest bottom tabs navigator inside a stack navigator你能做什么 go 是Nest bottom tabs navigator inside a stack navigator
and put the global screens inside the stack navigator并将全局屏幕放在堆栈导航器中
something like this:是这样的:
function bottomTabNavigator() {
return (
<Tab.Navigator>
<Tab.Screen name="Feed" component={Feed} />
<Tab.Screen name="Messages" component={Messages} />
</Tab.Navigator>
);
}
function App() {
return (
<Stack.Navigator>
<Stack.Screen
name="Home"
component={bottomTabNavigator}
options={{ headerShown: false }}
/>
<Stack.Screen name="GlobalScreen" component={GloballyAccessedScreen} />
</Stack.Navigator>
);
}
for the second part of your question, to go back you should use navigation.goBack();
对于问题的第二部分,返回 go 应该使用navigation.goBack();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.