[英]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.