javascript - How to add a button on the bottomTabNavigator rather than navigating to a screen in react native? - Stack Overflow

I am using react-navigation 6. my requirement is to add a signout button in the bottom tab, I have a bo

I am using react-navigation 6. my requirement is to add a signout button in the bottom tab, I have a bottomTabNavigator. So, I want to add that button on the bottom tabs so as soon as it is pressed the user is logged out. is there a way this can be done?

I am using react-navigation 6. my requirement is to add a signout button in the bottom tab, I have a bottomTabNavigator. So, I want to add that button on the bottom tabs so as soon as it is pressed the user is logged out. is there a way this can be done?

Share Improve this question asked Jan 27, 2022 at 18:43 YusYus 1841 gold badge7 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You can override tabBarButton options inside your Tab.Screen. Like this:

const = LogoutComponent = () => {
  return null;
}

const navigator = () => {

  return (
    <Tab.Navigator>
      <Tab.Screen name="Logout" ponent={LogoutComponent} options={{
        tabBarButton: () => (<TouchableOpacity onPress={() => logout()}/>),
      }} />
    <Tab.Navigator>
  )
}

References: https://medium./@my.maithi/react-native-navigation-add-custom-button-in-the-middle-of-tabbar-6c390201a2bb

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744957184a4603263.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信