Tell us which versions you are using:
Set the navigation title either based on component's internal state, or a redux value. the ideal case would be something like:
componentWillReceiveProps(nextProps) {
this.context.navBar.setTitle(nextProps.whatever.name);
// or
this.props.navBar.setTitle(nextProps.whatever.name);
}
In NavBar.js implementation there's:
renderTitle(childState, index:number) {
const title = this.props.getTitle ? this.props.getTitle(childState) : childState.title;
As far as I understand, when the navigation is rendering it looks for getTitle() or a static title being set on <Scene />, I have no idea how to connect that to a component's internal state / props (which can change asynchrony) or a redux store.
Real world example, if I pass an id to a component Actions.showPost({ id: 123 }) it renders the scene for <Post />, then the component will fetch the post from network, and then I want to update the navigation title to show the post's title up there...
componentWillReceiveProps(nextProps) {
Actions.refresh({title: nextProps.whatever.name})
}
@sarovin thank you!
or in your Actions[scene]() call works as well, on the previous component:
Actions.details({title:getDisplayName()})
Most helpful comment
componentWillReceiveProps(nextProps) {
Actions.refresh({title: nextProps.whatever.name})
}