Current Behavior
Hi everyone,
I want to set the background color for the Bottom Tab. So I did as below.
<Tab.Navigator
tabBarOptions={{
activeTintColor: '#FF0000',
activeBackgroundColor: '#FFFFFF',
inactiveBackgroundColor: '#FF0000',
inactiveTintColor: '#FFFFFF'
}}>
<Tab.Screen
name="Home"
component={HomeScreen}
/>
<Tab.Screen
name="Account"
component={AccountScreen}
/>
</Tab.Navigator>
The problem is the SafeArea has a white background
Expected Behavior
What I expect is
So could you tell me how to solve this issue in React Navigation version 5 please? Thank you!
Your Environment
iOS react-native: 0.61.5
@react-navigation/native: ^5.0.5
@react-navigation/bottom-tabs: ^5.0.5
Bottom tabs refers to a row of links, displayed at the bottom of the screen, and is referred to as "Tab Bar" in iOS and as "Bottom Navigation Bar" on Android. Usually these are intended to be used to switch between top-level content views with a single tap.
import { SafeAreaView } from 'react-native'; You just use it in place of the top-level View component. It makes sure content within the safe area boundaries is properly rendered around the nested content and applies padding automatically.
I just set backgroundColor
<Tab.Navigator
initialRouteName="Stack_Main"
tabBarOptions={{
style: {
backgroundColor: "#FF0000",
},
}}
>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With