在反应导航中无法从内部堆栈导航到外部堆栈

时间:2018-10-15 11:05:48

标签: reactjs react-native react-navigation react-navigation-stack

我有一个应用程序,必须使用堆栈和标签进行大量导航。

所以我有这些堆栈:

Routes (StackNavigation)
  - Start 
  - Login
  - ProtectedRoutes (TabNavigator)
    // Depending on which type of user is logged in
    // I have to change the number of tabs that are displayed
    - Reports (StackNavigator)
      - ...More Routes
    - Payments (StackNavigator)
      - ...More Routes
    - Invoices (StackNavigator)
      - ...More Routes
    - Account  (StackNavigator)
      - AccountPage
        // The account page has a button "Logout", 
        // when clicked removes all the user data
        // and should redirect to Login screen 
        // from Routes stack (The Root Stack)

问题:每当我单击AccountPage中的“注销”按钮时,RN都会抛出一个错误,指出没有定义为“登录名”的路由(这是因为我们在帐户堆栈中并且在那里没有定义为Login)。

现在,我如何将用户从内部堆栈(即Routes)重定向到根堆栈(即Accounts)中的登录屏幕?

0 个答案:

没有答案