0

Our React-baseed mobile app needs to change the page title after returning from a subpage. The initial title is set like this

static createRoute = (route: Route): Route => {
    let result = { ...route };
    result.title = (route.props as any).location.name as string;
    return result;
}

mapStateToProps and render are called with the new location.name in their props, but I can't see how to then change the title that appears in the navigation bar of the app.

According to this answer I should use this.props.navigation but my props never has a 'navigation' property. It does have a 'route' but it's ready-only.

Craig
  • 8,093
  • 8
  • 42
  • 74
  • what navigation lib did you used? `this.props.navigation` is for [React Navigation](https://github.com/react-navigation/react-navigation) – flix Jul 04 '18 at 02:38
  • Hard to tell. This got handed to us as a complete app and I'm now digging through it to make updates. I hoped the createRoute code would help identify which ever one it is – Craig Jul 04 '18 at 02:40
  • take a look at `package.json` and see `"dependencies"`, you can see all lib installed in your project – flix Jul 04 '18 at 02:42
  • probably this one onsenui-react-redux-navigator – Craig Jul 04 '18 at 03:01
  • never heard about [those lib](https://github.com/karlvr/onsenui-react-redux-navigator) ): – flix Jul 04 '18 at 03:05

0 Answers0