我的堆栈屏幕标题设置为route.params,每个标题均从后端加载
<Stack.Screen
name='MyDetailPage'
component={MyDetailPage}
options={({ route }) =>
({
title: route.params.detailPageTitle,
})}
/>
当我在详细信息页面上进行了一些修改时,页面将重新呈现并更新页面上的数据。但是,screenTitle(也在页面数据中)未更新。
我还如何使用页面数据和详细页面数据来更新screenTitle。
您可以使用反应导航提供的navigation.setOptions({title: "new title"})
功能。您可以阅读有关此here的更多信息。