如何使 TabNavigator 可滚动

J.s*_*row 0 react-native

我正在使用 TabNavigation 并且我有5 个以上的选项卡。所以横向我的文本我的选项卡越来越小。所以我想让我的 TabNavigator 可滚动。那么有什么办法可以做到这一点。是的,我已经在我的tabBarOptions 中使用了 scrollEnabled: true但什么也没发生。我是 React Native 的新手,我对 TabNavigator 的属性知之甚少。任何帮助都会很有用,提前谢谢你。

编辑:我已经检查了我的 Android 和 IOS 版本。在 Android 中 scrollableTabs 工作正常,但在 IOS 中没有滚动。

const TabNavigation = TabNavigator( { TabItem1: { screen: ProfileDetailScreen, navigationOptions: { tabBarLabel: "CURRENT EVENTS", } }, TabItem2: { screen: ProfileDetailScreen, navigationOptions: { tabBarLabel: "OPEN INVITATION", } }, TabItem3: { screen: ProfileDetailScreen, navigationOptions: { tabBarLabel: "ACCEPTED INVITATION", } }, TabItem4: { screen: ProfileDetailScreen, navigationOptions: { tabBarLabel: "MY EVENTS", } }, TabItem5: { screen: ProfileDetailScreen, navigationOptions: { tabBarLabel: "PAST EVENTS", } } }, { tabBarPosition: "top", swipeEnabled:false, animateStyle:false, tabBarOptions: { scrollEnabled: true, activeTintColor: Colors.goldColor, inactiveTintColor: Colors.goldColor, upperCaseLabel: false, showIcon: false, showLabel :true, labelStyle: { fontSize: 12, marginBottom:5, padding: 0 }, style: { backgroundColor: 'black', height: 50, borderWidth: 0 }, indicatorStyle: { backgroundColor: 'black', }, } }

csa*_*ath 5

应该在 tabBarOption 内传递 scrollEnabled

export const Tabs = TabNavigator({},{
    'lazy': true,
    tabBarOptions: {
        scrollEnabled: true
    },
  }
);
Run Code Online (Sandbox Code Playgroud)