如何用 react-navigation 删除双 header?
How to remove double header with react-navigation?
我的 React Native 0.61.5 使用 react-navigation 5.1
。这是根导航代码:
const BTab = createBottomTabNavigator();
const Stack = createStackNavigator();
export default function App() {
//const Appscreen = () => (<AppScreen data={data}/>);
return (
<NavigationContainer>
<Stack.Navigator InitialRouteName="Splash">
<Stack.Screen name="Splash" component={SplashScreen}}/>
<Stack.Screen name="App" component={AppScreen} } />
</Stack.Navigator>
</NavigationContainer>
);
}
组件AppScreen
return像这样的堆栈:
return (
<NavigationContainer independent={true}>
<BTab.Navigator>
<BTab.Screen name="Event" component={Eventstack} />
<BTab.Screen name="Group" component={Groupstack} />
<BTab.Screen name="Contact" component={Contactstack} />
</BTab.Navigator>
</NavigationContainer>
);
我注意到屏幕上有两个 header:
如何删除 App
header 而只保留 Group
?
添加要隐藏页眉的屏幕。
options= {{
headerShown: false
}}
如需进一步阅读,请查看 https://reactnavigation.org/docs/stack-navigator/#headershown
我的 React Native 0.61.5 使用 react-navigation 5.1
。这是根导航代码:
const BTab = createBottomTabNavigator();
const Stack = createStackNavigator();
export default function App() {
//const Appscreen = () => (<AppScreen data={data}/>);
return (
<NavigationContainer>
<Stack.Navigator InitialRouteName="Splash">
<Stack.Screen name="Splash" component={SplashScreen}}/>
<Stack.Screen name="App" component={AppScreen} } />
</Stack.Navigator>
</NavigationContainer>
);
}
组件AppScreen
return像这样的堆栈:
return (
<NavigationContainer independent={true}>
<BTab.Navigator>
<BTab.Screen name="Event" component={Eventstack} />
<BTab.Screen name="Group" component={Groupstack} />
<BTab.Screen name="Contact" component={Contactstack} />
</BTab.Navigator>
</NavigationContainer>
);
我注意到屏幕上有两个 header:
如何删除 App
header 而只保留 Group
?
添加要隐藏页眉的屏幕。
options= {{
headerShown: false
}}
如需进一步阅读,请查看 https://reactnavigation.org/docs/stack-navigator/#headershown