Passaro
Passaro

Reputation: 143

how to set a default value for a headerLeft?

Inside of my component render() method, I'm doing the following:

    if (this.state.text) {
      this.props.navigation.setOptions({
        headerLeft: this.headerLeft,
      });
    } else {
      this.props.navigation.setOptions({
        headerLeft: this.headerDEFAULT,
      });
    }

I would like to leave headerLeft as empty instead of this.headerDEFAULT, to go back to its default state. How can that be done?

Upvotes: 0

Views: 386

Answers (1)

Engazan
Engazan

Reputation: 525

it looks like this is inside of screen then use navigation.setOptions

headerLeft prop is your custom component so you override it

const navigation = useNavigation()
navigation.setOptions({headerLeft: (...props) => null})

Upvotes: 0

Related Questions