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‘
但实际的结果是:“家”,“我的”
screen: home, // This attribute works
tabBarLabel: 'cc', // Why he didn't work
showLabel: false, // Why he didn't work文档:https://reactnavigation.org/docs/en/bottom-tab-navigator.html
发布于 2019-11-29 16:41:18
您必须将它们作为navigationOptions传递:
home: {
screen: home,
navigationOptions: {
tabBarLabel: "cc"
}
}关于标签部分,您只能在bottomTabNavigator上全局更改它:
const TabOptions = {
swipeEnabled: true,
animationEnabled: true,
tabBarOptions: {
showLabel : false
}
};如果您想将其隐藏在特定选项卡中,您可以传递:
navigationOptions: {
tabBarLabel: " "
}https://stackoverflow.com/questions/59101122
复制相似问题