javascript– 如何在React-Navigation中单击Bottom Tab Navigator打开DrawerNavigator?

javascript– 如何在React-Navigation中单击Bottom Tab Navigator打开DrawerNavigator?,第1张

概述我正在使用react-navigation并尝试在BottomTabNavigator中单击选项卡项时打开抽屉(使用DrawerNavigator).我目前的代码看起来像这样exportdefaultcreateBottomTabNavigator({Dashboard:{screen:Dashboard,navigationOptions:{tabBarLabel:'Dashboar

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

我目前的代码看起来像这样

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  }})

我想点击bottomTabNavigator打开drawerNavigator.即,每当按下更多标签时,drawerNavigator都会打开.

我怎样才能做到这一点 ?

我是React-Native的新手.

解决方法:

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

例如.

tabbarOnPress: (tab) => {        //your code and other stuff         tab.jumpToIndex(tab.scene.index) }
总结

以上是内存溢出为你收集整理的javascript – 如何在React-Navigation中单击Bottom Tab Navigator打开DrawerNavigator?全部内容,希望文章能够帮你解决javascript – 如何在React-Navigation中单击Bottom Tab Navigator打开DrawerNavigator?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1116732.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存