gpt4 book ai didi

android - React-Native:在@react-navigation/material-bottom-tabs 中更改徽章颜色

转载 作者:行者123 更新时间:2023-12-04 09:00:31 26 4
gpt4 key购买 nike

我可以更改 的颜色吗?徽章在 Material 底部标签中?因为默认情况下它已经是红色的,我需要更改它。如果可能,我该怎么做?

...

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>
);
};
// ...

关于android - React-Native:在@react-navigation/material-bottom-tabs 中更改徽章颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63582868/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com