How do I set the title of the navigation bar based on props, I want to do something like below.
static navigationOptions = {
title: this.props.navigation.state.params.name,
};
You can override navigationOptions
in the route config to do that for you:
// Optional: Override the `navigationOptions` for the screen
navigationOptions: ({ navigation }) => ({
title: `${navigation.state.params.name}'s Profile'`,
})
Source: https://reactnavigation.org/docs/stack-navigator.html#routeconfigs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With