简体   繁体   English

反应导航:嵌套路由不起作用

[英]react-navigation: nested routing not working

I am trying to achieve nested routing in the below example. 我在下面的示例中尝试实现嵌套路由。 But I am not able to navigate to "Other" route when I click on "Show me more of the app" button. 但是,当我单击“向我显示更多应用程序”按钮时,我无法导航至“其他”路线。 Any help is appreciated. 任何帮助表示赞赏。

https://snack.expo.io/rJYl02b6M https://snack.expo.io/rJYl02b6M

I know I can add Other to the parent StackNavigator but I need some common component and that is why I want to wrap the OtherSr=tack router with a component. 我知道我可以将Other添加到父StackNavigator中,但是我需要一些通用组件,这就是为什么我想用一个组件包装OtherSr = tack路由器。

Thanks for the live example. 感谢您的现场示例。 You just need to add: 您只需要添加:

Other: OtherStack,

to your SwitchNavigator . 到您的SwitchNavigator

So you'd have: 因此,您将拥有:

export default SwitchNavigator(
  {
    AuthLoading: AuthLoadingScreen,
    App: AppStack, 
    Auth: AuthStack,
    Other: OtherStack,
  },
  {
    initialRouteName: 'AuthLoading',
  }
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM