1
votes

I have this error:

Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

My code :

export default class Header_page extends Component {
  render() {
    return (
      <Header>
        <Left>
          <Button transparent>
            <Icon name='ios-menu' />
          </Button>
        </Left>
        <Body>
          <Title>{this.props.title}</Title>
        </Body>
        <Right>
          <View>
            {this.props.buttonRight}
          </View>
        </Right>
      </Header>
    );
  }
}

Header_page.propTypes = {
  title: PropTypes.string.isRequired,
  buttonRight: PropTypes.func,
}

I don't understand what wrong thanks

1

1 Answers

2
votes

Seems like this.props.buttonRight is declared as a function but you are not calling it, you should call it in your render() like so this.props.buttonRight(). Make sure this.props.buttonRight() returns some JSX or null

Edit

A little note: when passing a function which returns some component, I'd recommend you call it renderSomething, for example renderButton. If you pass a Component instead, call it something or button