【发布时间】:2020-09-20 07:39:48
【问题描述】:
我的应用中有 3 个屏幕:“主页、联系人、个人资料”。我创建了一个自定义标题以显示在主页和联系人中,但不在个人资料屏幕中。问题是:我的自定义标题没有隐藏在配置文件屏幕中。如果我删除我的自定义标头以使用默认标头,它会隐藏,但是当我回到我的自定义标头时,这不会发生。
App.js
<NavigationContainer ref={navigationRef}>
<Stack.Navigator
headerMode="float"
initialRouteName="Home"
screenOptions={{
header: props => <CustomHeader {...props} />
}}>
<Stack.Screen
name="Home"
component={Home}
options={{
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS
}}/>
<Stack.Screen name="Contacts" component={Contacts}
options={{
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS
}}/>
<Stack.Screen
name="Profile"
component={Profile}
options={{
headerShown: false
}} />
</Stack.Navigator>
</NavigationContainer>
【问题讨论】:
标签: react-native react-navigation react-native-navigation react-navigation-stack react-navigation-v5