如何从标签栏中删除屏幕名称
How to remove screen names from a tab bar
我使用此标签栏在我的应用程序中导航,但我不知道如何删除图标下的名称,有什么提示吗?
在您的 TabBar
配置中设置 title=""
。这不会显示标签。
查看工作示例here
<Tab.Navigator
screenOptions={({ route }) => ({
title: '', // This is the main part...
tabBarIcon: ({ focused, color, size }) => GiveIcon({ route, focused, color, size }) })}
tabBarOptions={{
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
}}>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>
我使用此标签栏在我的应用程序中导航,但我不知道如何删除图标下的名称,有什么提示吗?
在您的 TabBar
配置中设置 title=""
。这不会显示标签。
查看工作示例here
<Tab.Navigator
screenOptions={({ route }) => ({
title: '', // This is the main part...
tabBarIcon: ({ focused, color, size }) => GiveIcon({ route, focused, color, size }) })}
tabBarOptions={{
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
}}>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>