How to go to parent stack navigation screen from child drawer navigation











up vote
0
down vote

favorite












I have a Drawer navigation and stack navigation on my app.



export const AppDrawerNavigator = createDrawerNavigator(
{
Home: {
screen: Home,
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<Icon name="home" style={{ fontSize: 24, color: tintColor }} />
)
}
},
MyAccount: {
screen: MyAccount,
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<Icon name="paper" style={{ fontSize: 24, color: tintColor }} />
)
}
},
Cashback: {
screen: Cashback,
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<Icon name="pizza" style={{ fontSize: 24, color: tintColor }} />
)
}
},
Settings: {
screen: Settings,
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<Icon name="settings" style={{ fontSize: 24, color: tintColor }} />
)
}
},
Campaigns: {
screen: Campaigns,
navigationOptions: {
drawerIcon: ({ tintColor }) => (
<Icon name="call" style={{ fontSize: 24, color: tintColor }} />
)
}
}
},
{
contentComponent: CustomDrawerComponent,
contentOptions: { activeTintColor: "#60c2a2" }
}
);

export const AppStackNavigator = createStackNavigator(
{
OnBoarding: {
screen: OnBoardingContent
},
Login: {
screen: Login
},
MarchantLogin: {
screen: MarchantLogin
},
OTPScreen: {
screen: OTPScreen
},
Home: {
screen: Home
},
Drawer: {
screen: AppDrawerNavigator
}
},
{
headerMode: "none",
initialRouteName: "Drawer",
navigationOptions: {
headerVisible: false
}
}
);


Then I call this on



render() {
if (this.state.is_verified == "true") {
return <AppStackNavigator />;
} else {
return <OnBoarding />;
}
}


My problem is that when I click on logout inside Drawer button I need to route to OnBoarding component. But how is it possible?
enter image description here



Please help me to solve this or suggest me a better idea because I'm new to this stack. Thankyou.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I have a Drawer navigation and stack navigation on my app.



    export const AppDrawerNavigator = createDrawerNavigator(
    {
    Home: {
    screen: Home,
    navigationOptions: {
    drawerIcon: ({ tintColor }) => (
    <Icon name="home" style={{ fontSize: 24, color: tintColor }} />
    )
    }
    },
    MyAccount: {
    screen: MyAccount,
    navigationOptions: {
    drawerIcon: ({ tintColor }) => (
    <Icon name="paper" style={{ fontSize: 24, color: tintColor }} />
    )
    }
    },
    Cashback: {
    screen: Cashback,
    navigationOptions: {
    drawerIcon: ({ tintColor }) => (
    <Icon name="pizza" style={{ fontSize: 24, color: tintColor }} />
    )
    }
    },
    Settings: {
    screen: Settings,
    navigationOptions: {
    drawerIcon: ({ tintColor }) => (
    <Icon name="settings" style={{ fontSize: 24, color: tintColor }} />
    )
    }
    },
    Campaigns: {
    screen: Campaigns,
    navigationOptions: {
    drawerIcon: ({ tintColor }) => (
    <Icon name="call" style={{ fontSize: 24, color: tintColor }} />
    )
    }
    }
    },
    {
    contentComponent: CustomDrawerComponent,
    contentOptions: { activeTintColor: "#60c2a2" }
    }
    );

    export const AppStackNavigator = createStackNavigator(
    {
    OnBoarding: {
    screen: OnBoardingContent
    },
    Login: {
    screen: Login
    },
    MarchantLogin: {
    screen: MarchantLogin
    },
    OTPScreen: {
    screen: OTPScreen
    },
    Home: {
    screen: Home
    },
    Drawer: {
    screen: AppDrawerNavigator
    }
    },
    {
    headerMode: "none",
    initialRouteName: "Drawer",
    navigationOptions: {
    headerVisible: false
    }
    }
    );


    Then I call this on



    render() {
    if (this.state.is_verified == "true") {
    return <AppStackNavigator />;
    } else {
    return <OnBoarding />;
    }
    }


    My problem is that when I click on logout inside Drawer button I need to route to OnBoarding component. But how is it possible?
    enter image description here



    Please help me to solve this or suggest me a better idea because I'm new to this stack. Thankyou.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a Drawer navigation and stack navigation on my app.



      export const AppDrawerNavigator = createDrawerNavigator(
      {
      Home: {
      screen: Home,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="home" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      MyAccount: {
      screen: MyAccount,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="paper" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      Cashback: {
      screen: Cashback,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="pizza" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      Settings: {
      screen: Settings,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="settings" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      Campaigns: {
      screen: Campaigns,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="call" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      }
      },
      {
      contentComponent: CustomDrawerComponent,
      contentOptions: { activeTintColor: "#60c2a2" }
      }
      );

      export const AppStackNavigator = createStackNavigator(
      {
      OnBoarding: {
      screen: OnBoardingContent
      },
      Login: {
      screen: Login
      },
      MarchantLogin: {
      screen: MarchantLogin
      },
      OTPScreen: {
      screen: OTPScreen
      },
      Home: {
      screen: Home
      },
      Drawer: {
      screen: AppDrawerNavigator
      }
      },
      {
      headerMode: "none",
      initialRouteName: "Drawer",
      navigationOptions: {
      headerVisible: false
      }
      }
      );


      Then I call this on



      render() {
      if (this.state.is_verified == "true") {
      return <AppStackNavigator />;
      } else {
      return <OnBoarding />;
      }
      }


      My problem is that when I click on logout inside Drawer button I need to route to OnBoarding component. But how is it possible?
      enter image description here



      Please help me to solve this or suggest me a better idea because I'm new to this stack. Thankyou.










      share|improve this question















      I have a Drawer navigation and stack navigation on my app.



      export const AppDrawerNavigator = createDrawerNavigator(
      {
      Home: {
      screen: Home,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="home" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      MyAccount: {
      screen: MyAccount,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="paper" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      Cashback: {
      screen: Cashback,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="pizza" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      Settings: {
      screen: Settings,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="settings" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      },
      Campaigns: {
      screen: Campaigns,
      navigationOptions: {
      drawerIcon: ({ tintColor }) => (
      <Icon name="call" style={{ fontSize: 24, color: tintColor }} />
      )
      }
      }
      },
      {
      contentComponent: CustomDrawerComponent,
      contentOptions: { activeTintColor: "#60c2a2" }
      }
      );

      export const AppStackNavigator = createStackNavigator(
      {
      OnBoarding: {
      screen: OnBoardingContent
      },
      Login: {
      screen: Login
      },
      MarchantLogin: {
      screen: MarchantLogin
      },
      OTPScreen: {
      screen: OTPScreen
      },
      Home: {
      screen: Home
      },
      Drawer: {
      screen: AppDrawerNavigator
      }
      },
      {
      headerMode: "none",
      initialRouteName: "Drawer",
      navigationOptions: {
      headerVisible: false
      }
      }
      );


      Then I call this on



      render() {
      if (this.state.is_verified == "true") {
      return <AppStackNavigator />;
      } else {
      return <OnBoarding />;
      }
      }


      My problem is that when I click on logout inside Drawer button I need to route to OnBoarding component. But how is it possible?
      enter image description here



      Please help me to solve this or suggest me a better idea because I'm new to this stack. Thankyou.







      reactjs react-native react-navigation react-navigation-stack react-navigation-drawer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 14:52

























      asked Nov 10 at 14:42









      SOBIR N

      18519




      18519





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240033%2fhow-to-go-to-parent-stack-navigation-screen-from-child-drawer-navigation%23new-answer', 'question_page');
          }
          );

          Post as a guest





































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240033%2fhow-to-go-to-parent-stack-navigation-screen-from-child-drawer-navigation%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python