【问题标题】:Swiping between tabs using createMaterialBottomTabNavigator for android使用适用于 android 的 createMaterialBottomTabNavigator 在选项卡之间滑动
【发布时间】:2018-11-07 20:34:09
【问题描述】:

我已使用 React Navigation 的 createMaterialBottomTabNavigator 在我的应用程序中创建底部选项卡导航器。我希望屏幕在更改选项卡时从左侧或右侧“滑入”,并在屏幕上滑动以更改选项卡。我查看了文档https://reactnavigation.org/docs/en/material-bottom-tab-navigator.html,但找不到任何可以实现这一点的配置选项。这是为什么呢?

【问题讨论】:

  • 认为这就是Transitioner的用途,但我从未使用过,尽管reactnavigation.org/docs/en/transitioner.html值得一看
  • Transitioner 作为一个单独的组件工作,但是,用于构建您自己的导航器。为什么 createMaterialBottomTabNavigator 或 createBottomTabNavigator 中没有内置用于滑动动画的配置选项,就像 createMaterialTopTabNavigator 一样?

标签: android react-native react-navigation


【解决方案1】:

解决方案

您可以使用createMaterialTopTabNavigator 代替createMaterialBottomTabNavigator 并将tabBarPosition 选项设置为底部。 Official

为什么?

swipeEnabled 在 React Navigation > 2.0 的 BottomTabnavigator 中不再支持。

另外值得注意的是,createBottomTabNavigator 与通过 TabNavigator 提供的底部选项卡导航器不同,它不支持 animationEnabled 或 swipeEnabled 属性。

检查Release note

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-17
    • 2020-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多