Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change navigation header background color

Tags:

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' />   }); 
like image 671
arled Avatar asked Jul 26 '17 14:07

arled


People also ask

How do I change the background color of my header?

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.

How do I change the header color in react-native navigation?

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.

How do I create a custom header in react navigation?

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.


1 Answers

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' />    });
like image 94
Aakash Sigdel Avatar answered Sep 30 '22 07:09

Aakash Sigdel