在React移动应用程序中动态更改页面标题

时间:2018-07-04 01:59:03

标签: react-native

我们基于React的移动应用从子页面返回后需要更改页面标题。初始标题设置如下:

static createRoute = (route: Route): Route => {
    let result = { ...route };
    result.title = (route.props as any).location.name as string;
    return result;
}
在道具中使用新的location.name调用

mapStateToProps render ,但我看不到如何更改导航栏中显示的标题的应用程序。

根据this answer,我应该使用 this.props.navigation ,但是我的道具从不具有“ navigation”属性。它确实有一个“路线”,但仅准备就绪。

0 个答案:

没有答案