简体   繁体   English

如何在 bottomTabNavigator 上添加一个按钮,而不是在 react native 中导航到屏幕?

[英]How to add a button on the bottomTabNavigator rather than navigating to a screen in react native?

I am using react-navigation 6. my requirement is to add a signout button in the bottom tab, I have a bottomTabNavigator.我正在使用 react-navigation 6. 我的要求是在底部选项卡中添加一个注销按钮,我有一个 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?有没有办法做到这一点?

Sure, it can be done.当然,这是可以做到的。 I would recommend you to go through the official documentation of BottomTabsNavigator and try to find out a way on your own as it will help you to solve the problems in the future.我会通过BottomTabsNavigator的官方文档向您推荐go ,并尝试自己找出方法,因为它将帮助您解决将来的问题。

Hint Your TabBar function might be returning some components ie Button or TouchableOpacity.提示您的 TabBar function 可能会返回一些组件,即 Button 或 TouchableOpacity。 Just use the onPress props of the component to open a logout alert just like you might be doing to navigate between the screens.只需使用组件的 onPress 道具来打开注销警报,就像您在屏幕之间导航一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 添加自定义按钮以响应导航底部TabNavigator? - Add custom button to react navigation bottomTabNavigator? 在 React Native 中点击按钮时导航到另一个屏幕 - Navigating to another Screen when a button is tapped in React Native 如何在屏幕上显示不止一部电影,而不是只显示来自 moviesDB api 的电影反应原生? - How to display more than one movie on the screen rather than just displaying one movie from the moviesDB api in react native? react native导航时如何打开下一个屏幕的模态? - How to open the modal of next screen while navigating in react native? React Native:如何将道具从一个屏幕导航到另一个屏幕 - React Native: How to pass props navigating from one screen to another 反应原生 BottomTabNavigator 奇怪的 Animation - React native BottomTabNavigator Strange Animation 如何在 React Navigation (4.x) 的特定屏幕中隐藏 BottomTabNavigator - How to hide BottomTabNavigator in certain screen in React Navigation (4.x) 反应本机导航并导航到另一个屏幕问题 - React Native Navigation and navigating to another Screen problem 如何在 React Native 中添加按钮? - How to add a button in React Native? Wix React原生导航选项卡按钮在导航回屏幕时超出范围 - Wix React native navigation tab button goes out of bound on navigating back to screen
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM