React native 如何删除单个选项卡的tabBarLabel,并在react native的tabnavigation中仅放置tabBarIcon?
我想在各个选项卡上设置showLabel=false。但它不起作用。 我只想有目录图标,而不是它的标签以及图标 Homescreen.js文件代码-React native 如何删除单个选项卡的tabBarLabel,并在react native的tabnavigation中仅放置tabBarIcon?,react-native,react-native-android,navigationbar,tabbar,react-navigation,React Native,React Native Android,Navigationbar,Tabbar,React Navigation,我想在各个选项卡上设置showLabel=false。但它不起作用。 我只想有目录图标,而不是它的标签以及图标 Homescreen.js文件代码- import React, { Component } from 'react'; import { StyleSheet, Text, View, Image,Dimensions } from 'react-native'; import { TabNavigator } from 'react-navigation'; imp
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View, Image,Dimensions
} from 'react-native';
import { TabNavigator } from 'react-navigation';
import ChatScreen from './ChatScreen.js';
import TaskScreen from './TaskScreen.js';
import FormScreen from './FormScreen.js';
import Directory from './Directory.js';
import Menu from './Menu.js';
const initialLayout = {
height: 0,
width: Dimensions.get('window').width,
};
var MainScreenNavigator = TabNavigator ({
Directory: {screen: Directory},
ChatScreen: {screen: ChatScreen},
TaskScreen: {screen: TaskScreen},
FormScreen: {screen: FormScreen},
Menu: {screen: Menu},
},
{
tabBarPosition: 'top',
animationEnabled: true,
tabBarOptions: {
inactiveTintColor: '#9fffa9',
activeTintColor: '#ffffff',
showIcon: true,
style: {
backgroundColor: '#00dc17',
},
labelStyle:{
fontSize: 16,
fontWeight: '400',
fontFamily: 'WorkSans-SemiBold',
},
tabStyle: {
},
indicatorStyle: {
backgroundColor : '#fff',
height : 2
}
},
}
);
MainScreenNavigator.navigationOptions ={
header: false,
};
export default MainScreenNavigator;
将此添加到您的
目录.js
:
static navigationOptions = ({ navigation }) => ({
tabBarLabel: <View/>
})
静态导航选项=({navigation})=>({
tabBarLabel:
})
将其添加到您的目录.js
:
static navigationOptions = ({ navigation }) => ({
tabBarLabel: <View/>
})
静态导航选项=({navigation})=>({
tabBarLabel:
})