React Navigation:当从redux更新的页面数据响应导航V5.0时更新屏幕标题

问题描述 投票:0回答:1

我的堆栈屏幕标题设置为route.params,每个标题均从后端加载

<Stack.Screen
     name='MyDetailPage'
     component={MyDetailPage}
     options={({ route }) =>
              ({
                   title: route.params.detailPageTitle,
              })}
     />

当我在详细信息页面上进行了一些修改时,页面将重新呈现并更新页面上的数据。但是,screenTitle(也在页面数据中)未更新。

我还如何使用页面数据和详细页面数据来更新screenTitle。

react-native redux react-navigation
1个回答
0
投票

您可以使用反应导航提供的navigation.setOptions({title: "new title"})功能。您可以阅读有关此here的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.