Node.js 如何从React Native Navigator中删除标题?

Node.js 如何从React Native Navigator中删除标题?,node.js,react-native,Node.js,React Native,我有一个选项卡栏导航器(水平滑动),设置在屏幕底部,我希望该栏只有图标,没有标题,以下是当前的设计: 代码如下: const AppTabNavigator = createMaterialTopTabNavigator({ Home: { screen: HomeScreen, navigationOptions: { tabBarLabel: 'Home', tabBarIcon: ({ tintCol

我有一个选项卡栏导航器(水平滑动),设置在屏幕底部,我希望该栏只有图标,没有标题,以下是当前的设计:

代码如下:

const AppTabNavigator = createMaterialTopTabNavigator({
    Home: {
        screen: HomeScreen,
        navigationOptions: {
            tabBarLabel: 'Home',
            tabBarIcon: ({ tintColor }) => (
                <Icon name="ios-home" style={{color: 'white'}} color={tintColor} size={24} />
            )
        }
    },
    Hot: {
        screen: SettingsScreen,
        navigationOptions: {
            tabBarLabel: 'Hot',
            tabBarIcon: ({ tintColor }) => (
                <Icon name="ios-flame" style={{color: 'white'}} color={tintColor} size={24} />
            )
        }
    }
}, {
        order: ['Home', 'Hot'],
        tabBarPosition: 'bottom',
        swipeEnabled: true,
        animationEnabled: true,
        tabBarOptions: {
            activeTintColor: 'orange',
            inactiveTintColor: 'grey',
            style: {
                backgroundColor: '#4050B5',
                borderTopWidth: 0.5,
                borderTopColor: 'grey'
            },
            indicatorStyle: {
                height: 0
            },
            showIcon: true
        }
})
const AppTabNavigator=createMaterialTopTabNavigator({
主页:{
屏幕:主屏幕,
导航选项:{
tabBarLabel:“主页”,
tabBarIcon:({tintColor})=>(
)
}
},
热门:{
屏幕:设置屏幕,
导航选项:{
tabBarLabel:'热',
tabBarIcon:({tintColor})=>(
)
}
}
}, {
订单:['家','热'],
tabBarPosition:'底部',
是的,
animationEnabled:没错,
选项卡选项:{
activeTintColor:“橙色”,
颜色:“灰色”,
风格:{
背景颜色:“#4050B5”,
borderTopWidth:0.5,
borderTopColor:“灰色”
},
指标类型:{
身高:0
},
showIcon:对
}
})
我希望选项卡栏没有标题,只有图标,但如果我删除tabBarLabel,它仍然会从“Home:{”和“Hot:{”中获得名称,我发现删除标题的唯一方法是将tabBarLabel设置为空格,空则不起作用:

tabBarLabel:'

但结果很糟糕:

我希望图标几乎不接触屏幕底部,就像唯一的填充是在图标的上方和下方一样。

使用

 tabBarLabel:() => {return null},
使用


您可以使用
tabBarOptions
showLabel
属性设置为false


以下是参考链接:

您可以使用
tabBarOptions
showLabel
属性设置为false


以下是参考链接:

完美!完美无瑕的结果,正是我想要的,它甚至删除了标题的保留空间。如果此解决方案对您有效,请不要忘记接受它。.很高兴为您提供帮助我只是以前无法接受,因为它有接受的时间保护,您回答得太快了哈完美!完美无瑕的结果t、 这正是我想要的,它甚至删除了标题的保留空间。如果此解决方案对您有效,请不要忘记接受它。.很高兴提供帮助我以前无法接受,因为它有接受的时间保护,您回答得太快了hahaIt不起作用,我尝试使用tabBarLabel并将showLabel设置为false,然后尝试使用out tabBarLabel仍在显示,可能是本机tab navigator的属性,我正在使用react navigation它应该可以工作。您正在使用react navigation v2 lib for tab,上面的链接将您重定向到相同的文档上。它不起作用,我尝试使用tabBarLabel并将showLabel设置为false,然后尝试不使用tabBarLabel,但仍在显示g、 可能是本机tab navigator的属性,我使用的是react navigation它应该可以工作。您使用的是react navigation v2 lib for tab,上面的链接会在相同的文档上重定向您。