在React-Navigation中单击“底部标签导航器”后,如何打开DrawerNavigator?

dak*_*waj 5 javascript android reactjs react-native

我正在使用react-navigation并尝试通过单击中的选项卡项打开抽屉(使用DrawerNavigator)BottomTabNavigator

我当前的代码如下所示

export default createBottomTabNavigator({
  Dashboard:{
      screen:Dashboard,
      navigationOptions:{
        tabBarLabel:'Dashboard',
        tabBarIcon:({tintColor}) => (
          <Icon name ="ios-speedometer-outline" color =
            {tintColor} size = {24} />
        )
      }
  },
  Customers:{
    screen:Customers,
    navigationOptions:{
      tabBarLabel:'Customers',
      tabBarIcon:({tintColor}) => (
        <Icon name ="ios-people-outline" color =
          {tintColor} size = {24} />
      )
    }
  },
  Invoice:{
    screen:Invoice,
    navigationOptions:{
      tabBarLabel:'Invoice',
      tabBarIcon:({tintColor}) => (
        <Icon name ="ios-copy-outline" color =
          {tintColor} size = {24} />
      )
    }
  },
  TimeTracker:{
    screen:TimeTracker,
    navigationOptions:{
      tabBarLabel:'Timetracker',
      tabBarIcon:({tintColor}) => (
        <Icon name ="ios-timer-outline" color =
          {tintColor} size = {24} />
      )
    }
  },
  More:{
   screen : More,

    navigationOptions:{
      tabBarLabel:'More',
      tabBarIcon:({tintColor}) => (
        <Icon name ="ios-menu-outline" color = {tintColor} size = {24} />
      )
    }
  }
},{
  tabBarOptions:{
    activeTintColor: 'red',
    inactiveTintColor: 'grey',
    style:{
      backgroundColor: 'white',
      borderTopWidth : 0,
      shadowOffset: {width:5,height : 3},
      shadowColor: 'black',
      shadowOpacity: 0.5,
      elevation: 5
    }
  }
})

const MyApp = createDrawerNavigator({
  Home :{
    screen : HomeScreen
  },
  Settings: {
    screen:SettingScreen
  }
})
Run Code Online (Sandbox Code Playgroud)

我想在bottomTabNavigator的单击上打开抽屉式导航器。即,每当按下“更多”选项卡时,drawerNavigator就会打开。

我怎样才能做到这一点 ?

我是React-Native的新手。

Jig*_*gar 0

您可以在导航选项中使用 tabBarOnPress 事件来修改选项卡导航单击

例如。

tabBarOnPress: (tab) => {
        //your code and other stuff 
        tab.jumpToIndex(tab.scene.index)
 }
Run Code Online (Sandbox Code Playgroud)