N
N
nuclear_kote2017-04-16 15:05:49
React
nuclear_kote, 2017-04-16 15:05:49

Why is dynamic header not working in react-native?

In this https://reactnavigation.org/docs/intro/ example, the dynamic header should work something like this:

static navigationOptions = ({ navigation }) => ({
    title: `Chat with ${navigation.state.params.user}`,
  });

but the function is not called at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Vasiliev, 2017-04-17
@nuclear_kote

Try like this:

...
componentWillMount() {
   this.props.navigation.setParams({  user: "name"  });
}
...

And see what happens. If everything remains the same, then I think it will be more efficient to look for a solution in the repository: https://github.com/react-community/react-navigatio...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question