Reactjs 在同一屏幕中创建两个抽屉和一个选项卡导航器

Reactjs 在同一屏幕中创建两个抽屉和一个选项卡导航器,reactjs,react-native,react-navigation,Reactjs,React Native,React Navigation,我有一个屏幕,有两个抽屉导航。可以在v1中处理两个抽屉,但它不再工作 我还想在同一屏幕上添加一个选项卡导航器,但我遇到了上面的问题 如何使用react navigation v2在一个屏幕中使用两个抽屉 这是我的路线配置: export const MainStack = createStackNavigator({ Home: { screen: HomeContainer, navigationOptions: { header: null },

我有一个屏幕,有两个抽屉导航。可以在v1中处理两个抽屉,但它不再工作

我还想在同一屏幕上添加一个选项卡导航器,但我遇到了上面的问题

如何使用react navigation v2在一个屏幕中使用两个抽屉

这是我的路线配置:

export const MainStack = createStackNavigator({
    Home: {
        screen: HomeContainer,
        navigationOptions: { header: null },
    },
    NewsList: {
        screen: NewsList,
        navigationOptions: { header: null },
    },
    NewsDetail: {
        screen: NewsDetail,
        path: 'news/:itemId',
        navigationOptions: { header: null },
    },
  },
  {
    mode: 'card',
    initialRouteName: 'Home',
    drawerBackgroundColor: '#151515',
    drawerPosition: 'right',
    drawerWidth: 80,
  },
);



export const MainDrawer = createDrawerNavigator({
    MainStack,
  },

  {
    initialRouteName: 'MainStack',
    drawerBackgroundColor: '#151515',
    drawerPosition: 'left',
    drawerWidth: 80,
    contentComponent: props => <LeftMenuContainer {...props} />,
    drawerOpenRoute: 'LeftSideMenu',
    drawerCloseRoute: 'LeftSideMenuClose',
    drawerToggleRoute: 'LeftSideMenuToggle',
  },
);

export const Root = createDrawerNavigator({
    MainStack
  },
  {
    navigationOptions: {
    },
    drawerBackgroundColor: '#151515',
    drawerPosition: 'right',
    drawerWidth: 80,
    contentComponent: props => <MenuContainer {...props} />,
    drawerOpenRoute: 'RightSideMenu',
    drawerCloseRoute: 'RightSideMenuClose',
    drawerToggleRoute: 'RightSideMenuToggle',
  },
);
export const-MainStack=createStackNavigator({
主页:{
屏幕:HomeContainer,
导航选项:{header:null},
},
新闻列表:{
屏幕:新闻列表,
导航选项:{header:null},
},
新闻详情:{
屏幕:NewsDetail,
路径:'news/:itemId',
导航选项:{header:null},
},
},
{
模式:“卡”,
initialRouteName:“主页”,
抽屉背景颜色:“#151515”,
抽屉位置:'对',
抽屉宽度:80,
},
);
导出常量MainDrawer=createDrawerNavigator({
梅斯特巴克,
},
{
initialRouteName:'MainStack',
抽屉背景颜色:“#151515”,
抽屉位置:'左',
抽屉宽度:80,
contentComponent:props=>,
DroperRopenRoute:“LeftSideMenu”,
抽屉闭合路线:“LeftSideMenuClose”,
DroperTogglerOute:“LeftSideMenuToggle”,
},
);
导出常量根=createDrawerNavigator({
中流砥柱
},
{
导航选项:{
},
抽屉背景颜色:“#151515”,
抽屉位置:'对',
抽屉宽度:80,
contentComponent:props=>,
抽屉路径:“右侧菜单”,
抽屉闭合路线:“右侧菜单闭合”,
抽屉切换按钮:“RightSideMenuToggle”,
},
);
应该有一个层次结构 将MainDrawer作为屏幕传递给Root

export const MainStack = createStackNavigator({
    Home: {
        screen: HomeContainer,
        navigationOptions: { header: null },
    },
    NewsList: {
        screen: NewsList,
        navigationOptions: { header: null },
    },
    NewsDetail: {
        screen: NewsDetail,
        path: 'news/:itemId',
        navigationOptions: { header: null },
    },
  },
  {
    mode: 'card',
    initialRouteName: 'Home',
    drawerBackgroundColor: '#151515',
    drawerPosition: 'right',
    drawerWidth: 80,
  },
);



export const MainDrawer = createDrawerNavigator({
    MainStack,
  },

  {
    initialRouteName: 'MainStack',
    drawerBackgroundColor: '#151515',
    drawerPosition: 'left',
    drawerWidth: 80,
    contentComponent: props => <LeftMenuContainer {...props} />,
    drawerOpenRoute: 'LeftSideMenu',
    drawerCloseRoute: 'LeftSideMenuClose',
    drawerToggleRoute: 'LeftSideMenuToggle',
  },
);

export const Root = createDrawerNavigator({
    MainDrawer
  },
  {
    navigationOptions: {
    },
    drawerBackgroundColor: '#151515',
    drawerPosition: 'right',
    drawerWidth: 80,
    contentComponent: props => <MenuContainer {...props} />,
    drawerOpenRoute: 'RightSideMenu',
    drawerCloseRoute: 'RightSideMenuClose',
    drawerToggleRoute: 'RightSideMenuToggle',
  },
);
export const-MainStack=createStackNavigator({
主页:{
屏幕:HomeContainer,
导航选项:{header:null},
},
新闻列表:{
屏幕:新闻列表,
导航选项:{header:null},
},
新闻详情:{
屏幕:NewsDetail,
路径:'news/:itemId',
导航选项:{header:null},
},
},
{
模式:“卡”,
initialRouteName:“主页”,
抽屉背景颜色:“#151515”,
抽屉位置:'对',
抽屉宽度:80,
},
);
导出常量MainDrawer=createDrawerNavigator({
梅斯特巴克,
},
{
initialRouteName:'MainStack',
抽屉背景颜色:“#151515”,
抽屉位置:'左',
抽屉宽度:80,
contentComponent:props=>,
DroperRopenRoute:“LeftSideMenu”,
抽屉闭合路线:“LeftSideMenuClose”,
DroperTogglerOute:“LeftSideMenuToggle”,
},
);
导出常量根=createDrawerNavigator({
主抽屉
},
{
导航选项:{
},
抽屉背景颜色:“#151515”,
抽屉位置:'对',
抽屉宽度:80,
contentComponent:props=>,
抽屉路径:“右侧菜单”,
抽屉闭合路线:“右侧菜单闭合”,
抽屉切换按钮:“RightSideMenuToggle”,
},
);

当我以这种方式编写路由并尝试使用此.props.navigation.openDrawer()打开抽屉时;它总是打开左边的主抽屉,我无法找出任何参数来定位左抽屉或右抽屉。是的,嗯,新的设置有很大的问题。你知道我应该怎么做吗?