Use 2 types of Drawer and Bottomtab navigation at the same time

Asked

Viewed 334 times

0

Hello, I’m a little confused about the routes of React-Native, I mean when I need to use 2 types of routes on the same screen. Here’s my try so far:

export default (isSigned = false) =>
  createAppContainer(
    createSwitchNavigator(
      {
        Sign: createSwitchNavigator({
          SignIn,
          SignUp,
        }),
        App: createBottomTabNavigator({
          Dashboard,
          Profile,
          Settings,
        }),
      },
      {
        initialRouteName: isSigned ? 'App' : 'Sign',
      },
    ),
  );

I’ve come this far where I can use the Tabnavigator or Drawer, not the two together.

1 answer

0


After a few minutes of research I solved as follows:

export default (isSigned = false) =>
  createAppContainer(
    createSwitchNavigator(
      {
        Sign: createSwitchNavigator({
          SignIn,
          SignUp,
        }),
        App: createBottomTabNavigator({
          Dashboard: {
            screen: createDrawerNavigator({
              Dashboard,
              Profile,
              Settings,
            }),
          },
          Profile: {
            screen: createDrawerNavigator({
              Dashboard,
              Profile,
              Settings,
            }),
          },
          Settings: {
            screen: createDrawerNavigator({
              Dashboard,
              Profile,
              Settings,
            }),
          },
        }),
      },
      {
        initialRouteName: isSigned ? 'App' : 'Sign',
      },
    ),
  );

Browser other questions tagged

You are not signed in. Login or sign up in order to post.