使用 createMaterialBottomTabNavigator for android 在选项卡之间滑动 [英] Swiping between tabs using createMaterialBottomTabNavigator for android
问题描述
我使用 React Navigation 的 createMaterialBottomTabNavigator 在我的应用程序中创建底部选项卡导航器.我希望屏幕在更改选项卡时从左侧或右侧滑入",并在屏幕上滑动以更改选项卡.我查看了文档 https://reactnavigation.org/docs/en/material-bottom-tab-navigator.html,我找不到任何可以实现这一点的配置选项.这是为什么?
I have used React Navigation's createMaterialBottomTabNavigator to create a bottom tab navigator in my app. I want the screens to "slide" in from the left or right when the tab is changed, and swiping on the screen to be able to change tabs. I've looked into the documentation https://reactnavigation.org/docs/en/material-bottom-tab-navigator.html, and I can't find any configuration options that would make this happen. Why is this?
推荐答案
解决方案
您可以使用 createMaterialTopTabNavigator
而不是 createMaterialBottomTabNavigator
并将 tabBarPosition
选项设置为底部.官方
Solution
You can use createMaterialTopTabNavigator
instead of createMaterialBottomTabNavigator
and set the tabBarPosition
option to bottom. Official
swipeEnabled
在 React Navigation > 2.0 的BottomTabnavigator 中不再支持.
swipeEnabled
is not supported anymore in BottomTabnavigator of React Navigation > 2.0.
另外值得注意的是,createBottomTabNavigator 与通过 TabNavigator 可用的底部选项卡导航器不同,因为它不支持 animationEnabled 或 swipeEnabled 属性.
It is worth noting additionally that createBottomTabNavigator is different from the bottom tab navigator that is available through TabNavigator in that it does not support animationEnabled or swipeEnabled properties.
检查 发行说明.
这篇关于使用 createMaterialBottomTabNavigator for android 在选项卡之间滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!