在StackNavigator中创建DrawerNavigator

时间:2018-09-17 12:12:44

标签: android ios reactjs react-native

我有一个如下所示的bottomTabNavigator。

const tabNavigator = createBottomTabNavigator({ [SCREEN1]: { screen: StackNavigator1 }, [SCREEN2]: { screen: StackNavigator2 }, [SCREEN3]: { screen: SplashScreen }, },

现在,我该如何在每个屏幕上创建DrawerNavigator?在普通屏幕上创建非常简单。如何在stackNavigator中创建它?

1 个答案:

答案 0 :(得分:1)

非常简单。您将DrawerNavigator设置为屏幕组件。 例如:

const dn1 = createDrawerNavigator({
   [Screen1]: {
       screen: Screen01
   }
});

const dn2= createDrawerNavigator({
    [Screen1]: {
        screen: Screen02
    }
 });

 const dn3 = createDrawerNavigator({
    [Screen1]: {
        screen: Screen03
    }
 });

const tabNavigator = createBottomTabNavigator({
    [SCREEN1]: {
        screen: dn1
    },
    [SCREEN2]: {
        screen: dn2
    },
    [SCREEN3]: {
        screen: dn3
    },
}

这样,每个选项卡都将具有单独的DrawerNavigator。