我有一个 navigator ( X) ,它拥有一个屏幕,我们称之为N,还有另一个 navigator ,Y. 我需要从 navigatorY中的屏幕移动N到根导航器中的屏幕。我将如何使用反应导航 6 来执行此操作?
根路由器的代码:
<NavigationContainer>
<Tabs.Navigator>
<Tabs.Screen component={HomeRouter} name="HomeTab" />
</Tabs.Navigator>
</NavigationContainer>
家庭路由器(导航器X)的代码:
<NavigationContainer independent={true}>
<Stack.Navigator initialRouteName={"Home"}>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Post" component={Post} />
<Stack.Screen name="Profile" component={Account} />
</Stack.Navigator>
</NavigationContainer>
配置文件路由器(导航器Y)的代码:
<NavigationContainer independent={true} theme={MyTheme}>
<Stack.Navigator>
<Stack.Screen name="MainProfile" component={MainAccountPage} />
</Stack.Navigator>
</NavigationContainer>
我需要从MainAccountPage屏幕导航navigator Y到Post.navigator X