createBottomTabNavigator如何修改标题?

问题描述 投票:0回答:1

mycode

routers.js

import {createBottomTabNavigator} from 'react-navigation-tabs';

import home from '../views/home';
import my from '../views/my';

const RouteConfigs = {
  home: {
    screen: home, // This attribute works
    tabBarLabel: 'cc', // Why he didn't work
    showLabel: false, // Why he didn't work
  },
  my: {
    screen: my,
  },
};

const TabOptions = {
  swipeEnabled: true,
  animationEnabled: true,
};

const StackNavigator = createBottomTabNavigator(RouteConfigs, TabOptions);

export default StackNavigator;
import {createAppContainer} from 'react-navigation';

import routers from './routers';

export default createAppContainer(routers);

问题

预期:['cc','my']] >>

但是实际结果:['home','my']

screen: home, // This attribute works
tabBarLabel: 'cc', // Why he didn't work
showLabel: false, // Why he didn't work

doc:https://reactnavigation.org/docs/en/bottom-tab-navigator.html

mycode routers.js从'react-navigation-tabs'导入{createBottomTabNavigator};从“ ../views/home”导入家;从'../views/my'导入my; const RouteConfigs = {主页:{屏幕:首页,...

react-native react-native-android react-navigation
1个回答
0
投票

您必须将它们作为navigationOptions通过:

© www.soinside.com 2019 - 2024. All rights reserved.