我可以在材料底部标签中更改徽章的颜色吗?因为默认情况下它已经是红色了,所以我想更改它。如果有可能,我该怎么做?
...
import {createMaterialBottomTabNavigator} from '@react-navigation/material-bottom-tabs';
...
const MainBottomTab = createMaterialBottomTabNavigator();
...
<MainBottomTab.Navigator
initialRouteName="Home"
activeColor="#C9C9C9"
inactiveColor="#4523AF"
barStyle={styles.menuBotao}>
...
<MainBottomTab.Screen
name="Publicações"
component={PublicacaoNavication}
options={{
tabBarLabel: '',
tabBarBadge: notificacoes !== undefined ? notificacoes.length : false, <-- I need to change the color
tabBarIcon: ({color}) => <Icon name={'filing'} color={color} />,
}}
/>
...
</MainBottomTab.Navigator>
...
您可以通过覆盖默认主题来做到这一点,如下所示:
import { DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
// Create your custom theme and override the notification color
const MyTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
notification: 'blue',
},
};
// Pass your theme to the PaperProvider wrapping your app
const App = () => {
return (
<PaperProvider theme={MyTheme}>
<NavigationContainer>
// The rest of your content...
</NavigationContainer>
</PaperProvider>
);
};
// ...
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句