reactjs - react native navigation3 我想隐藏底部标签导航的一个标签
问题描述
我想隐藏图片中以黄色突出显示的标签。
怎么做?
我的代码:
const MainBottomTab = createBottomTabNavigator({
HomeStack : {
screen : HomeStack,
navigationOptions : {
showlabel:false,
drawerLabel:NullComponent
}
} ,
SettingsStack,
},{
tabBarPosition:"bottom",
navigationOptions:{
},
tabBarOptions:{
activeTintColor: "green",
inactiveTintColor: "#00ccff",
style:{
backgroundColor: "white"
},
indicatorStyle:{
height: 0
},
showIcon:'true'
},
swipeEnabled:true,
});
解决方案
使用自定义 TabIcon
navigationOptions :({ navigation }) {
tabBarIcon: ({ tintColor }) => {
const { routeName } = navigation.state;
let iconName;
if (routeName === 'Home') iconName = 'home';
else if (routeName === 'Notifications') iconName = 'notifications';
else if (routeName === 'Readout') iconName = 'readout';
else if (routeName === 'Inbox') iconName = 'messages';
else if (routeName === 'Profile') iconName = 'profile';
//Tabicon is just custom Icon display widget . handle All tabicon in TabIcon by iconname
return <TabIcons iconName={iconName} tintColor={tintColor} />;
}
}
推荐阅读
- python - 在 Jupyter Notebook 上使用 PCA 可视化(绘制)数据集 csv
- sql-server - 未找到 Windows Django 数据源名称且未指定默认驱动程序
- sql - ORA-02290: 违反检查约束
- reactjs - 更新组件反应原生状态
- functional-programming - OCaml 中的 @@ 和 |> 运算符优先级
- php - 我怎样才能最好地从逗号分隔列表中循环出这个 xpath 表达式?
- javascript - 方法 ComponentDidMount - 向地图添加标记
- docker - 如何删除仅主机适配器,以便继续启动 Docker 快速启动终端?
- sql - 与连接等效工作的选择语句中的 PostgreSQL 子查询(不合逻辑)错误?
- python - 为什么我不能从同一目录中的类中导入函数?