我正在使用React Navigation,想知道如何在底部标签中添加徽章?
像“提醒”选项卡一样,如果我有3条提醒,我希望在“提醒”标签的图标的右上角有一个3的徽章
const TabStack = createBottomTabNavigator(
{
Home : { screen: HomeStack },
Reminders: { screen: ReminderStack},
},
{
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
const { routeName } = navigation.state;
let IconComponent = Ionicons;
let iconName;
if (routeName === 'Home') {
iconName = `ios-home`;
} else if (routeName === 'Reminders') {
iconName = `ios-alarm`;
}
return <IconComponent name={iconName} size={25} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: '#0892d0',
inactiveTintColor: 'gray',
},
}
);