As you can see below, I've tried many ways of setting the background color to green, all to no avail. The background remains blue like the image.
The inactiveColor
and activeColor
are working (white and red respectively).
<NavigationContainer>
<Tab.Navigator
initialRouteName="HomeScreen"
activeColor="red"
inactiveColor="white"
activeBackgroundColor="green"
inactiveBackgroundColor="green"
style={{ backgroundColor: 'green' }}
tabBarOptions={{
style:{
backgroundColor: 'green'
}
}}
>
<Tab.Screen
name="HomeScreen"
options={{
tabBarLabel: 'Home',
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="home" color={color} size={26} />
),
}}
>
{props => <HomeScreen {...props} state={this.state} />}
</Tab.Screen>
<Tab.Screen
name="Files"
component={FilesScreen}
options={{
tabBarLabel: 'Files',
tabBarIcon: ({ color }) => (
<MaterialCommunityIcons name="file" color={color} size={26} />
),
}}
/>
</Tab.Navigator>
</NavigationContainer>
package.json
"dependencies": {
"@react-native-community/masked-view": "^0.1.7",
"@react-navigation/material-bottom-tabs": "^5.1.7",
"@react-navigation/native": "^5.1.4",
}
You need to add the backgroundColor in screenOptions. https://reactnavigation.org/docs/bottom-tab-navigator/#screenoptions Try this:
<Tab.Navigator screenOptions={{
tabBarOptions: {
style: {
backgroundColor: '#f9f9f9',
},
},
}}>