Change navigation header background color

Led picture Led · Jul 26, 2017 · Viewed 31.7k times · Source

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

Answer

Aakash Sigdel picture Aakash Sigdel · Jul 26, 2017

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