伙计们我想用
static navigationOptions = ({ navigation }) => {
}
我使用的是react导航v5告诉我,我的理解是正确的,现在可以使用Stack.Screen?Exapmle中的唯一选项来获得头部设置。
<Stack.Screen
name="Home"
component={HomeScreen}
options={{
title: 'My home',
headerStyle: {
backgroundColor: '#f4511e',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
/>
</Stack.Navigator>
你可以使用 navigation.setOptions({ title: 'Updated!' })
来修改所需的导航选项。
您可以在屏幕组件中使用navigation.setOptions编辑屏幕的导航选项。https:/reactnavigation.orgdocsheaders#updating-options-with-setoptions。