Struggling to understand how to change the navigation header bar background color. I'm Using react navigation and Expo to build my app.
backgroundColor
does not seem to do anything. Any idea how to do this?
My code is below:
static navigationOptions = () => ({ title: 'My App', headerTintColor: Colors.DarkBlue, backgroundColor: 'red', headerLeft: <HeaderBarItem to='InfoScreen' title='App info' />, headerRight: <HeaderBarItem to='FeedbackScreen' title='Feedback' /> });
Go to the Design tab. Click Customize to expand the set of choices for customizing your theme. Click Header Image to choose an image to be the background of the header. Click Header background to choose a color for the header section.
Adjusting header styles There are three key properties to use when customizing the style of your header: headerStyle , headerTintColor , and headerTitleStyle . headerStyle : a style object that will be applied to the View that wraps the header. If you set backgroundColor on it, that will be the color of your header.
Left and Right Header Customization using }, [navigation]); In this example, We will create two screens and we will switch between them using React Navigation. On the first screen, you will see how to add custom title in header and on the second screen, you will see the left and right header customisation.
This should work:
static navigationOptions = () => ({ title: 'My App', headerTintColor: Colors.DarkBlue, headerStyle: { backgroundColor: 'red' }, headerLeft: <HeaderBarItem to='InfoScreen' title='App info' />, headerRight: <HeaderBarItem to='FeedbackScreen' title='Feedback' /> });
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