JavaScript Objects are not valid as a React child (React Navigation) objects are not valid react child

I'm using React Navigation, I want to add right button in StackNavigator. After adding right button, I get such error:

Object is not valid as React child (found: object with keys {right}). If you meant to render a collection of children, use an array instead

How to fix that error?

Here is the code:

import React, {Component} from 'react';
import {View, Text} from 'react-native';

class ReviewScreen extends Component {

  static navigationOptions = {
      title: 'Review Jobs',
      header: () => {
          return {
              right: <Text>Go right</Text> 
          };
      }
  }

    render (){
        return (
            <View>
                <Text>ReviewScreen</Text>
            </View>


        );
    }
}

export default ReviewScreen;
Answer:1

Don't use header. header expects a React Component that represents the whole header, not a plain object. Use headerRight:

static navigationOptions = {
  title: 'Review Jobs',
  headerRight: <Text>Go right</Text>
}
Answer:2

You can't render an object in the header options. You are returning an object instead of the text tag. Just change your code as below to make it working:-

      headerRight:<Text>Go right</Text> 

instead of :-

      header: () => {
      return {
          right: <Text>Go right</Text> 
      };
  }
Answer:3

In this example the ::before pseudo-element's content is not a static value, but a counter. I want to get the current value "2" instead of the general formula "counter(itemcounter)". // Expected ...

In this example the ::before pseudo-element's content is not a static value, but a counter. I want to get the current value "2" instead of the general formula "counter(itemcounter)". // Expected ...

  1. css text content before
  2. css add text before content
  3. content before text

I have the following scenario: <body class="theme-blue nav-black"> <a href="#" data-class="theme-blue">Blue theme </a> <a href="#" data-class="nav-black">Dark Nav</a>...

I have the following scenario: <body class="theme-blue nav-black"> <a href="#" data-class="theme-blue">Blue theme </a> <a href="#" data-class="nav-black">Dark Nav</a>...

  1. extract match from regex
  2. extract match from regex python
  3. extract match in python

I'm stuck in the situation where my child component (autocomplete) needs to update a value of its parent (Curve), And the parent needs to update the one of the child (or to completely re-render when a ...

I'm stuck in the situation where my child component (autocomplete) needs to update a value of its parent (Curve), And the parent needs to update the one of the child (or to completely re-render when a ...

I have written following jQuery for calculating age when user selects date from date picker and the focus of textbox(#dobfield) is lost then the calculated age should get displayed on textbox (#age). ...

I have written following jQuery for calculating age when user selects date from date picker and the focus of textbox(#dobfield) is lost then the calculated age should get displayed on textbox (#age). ...

  1. display selected date in datepicker
  2. display selected date from calendar into textbox
  3. display selected date in textbox in asp.net
  4. display selected date in jquery
  5. power bi display selected date range
  6. jquery datepicker display selected date
  7. show selected date in datepicker
  8. how to show selected date in datepicker
  9. selected date in jquery datepicker
  10. selected date in datepicker