Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
          }
    });
like image 493
cetinDev Avatar asked Apr 16 '26 02:04

cetinDev


2 Answers

Try this...

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

To hide navigationbar for specific page

static navigationOptions = {
         header:null
    }
like image 150
Arnold Brown Avatar answered Apr 17 '26 14:04

Arnold Brown


I guess, navigationOptions should be Object. Try this:

static navigationOptions = {
    title: 'Login', 
    header: {
        title: "Title",
        style: {
          backgroundColor: 'red'
        },
        tintColor: 'red'
      }
};
like image 25
Sajib Khan Avatar answered Apr 17 '26 14:04

Sajib Khan