cetinDev
cetinDev

Reputation: 319

React-native navigationbar color change error

I would like to change my navigationbar background color , but return to me : TypeError: Object is not a function(evaluating 'renderHeader');

How can i fix this error?

 static navigationOptions = ({navigation}) => ({
        title: 'Login', 
        header: {
            title: "Title",
            style: {
              backgroundColor: 'red'
            },
            tintColor: 'red'
          }
    });

Upvotes: 3

Views: 1831

Answers (2)

Arnold Brown
Arnold Brown

Reputation: 1433

Try this...

static navigationOptions = () => ({
    title: 'Contact Us',
    headerTintColor: Colors.Green,
    headerStyle: {
      backgroundColor: 'red'
    }
  });

To hide navigationbar for specific page

static navigationOptions = {
         header:null
    }

Upvotes: 4

Sajib Khan
Sajib Khan

Reputation: 24204

I guess, navigationOptions should be Object. Try this:

static navigationOptions = {
    title: 'Login', 
    header: {
        title: "Title",
        style: {
          backgroundColor: 'red'
        },
        tintColor: 'red'
      }
};

Upvotes: 2

Related Questions