Iba*_*man 6 react-native react-native-navigation react-navigation
使用自定义样式删除 React 导航 6 中的标头,这是堆栈导航的代码
<NavigationContainer>
<Stack.Navigator
initialRouteName='OtpScreen'
// screenOptions={{
// headerShown: false,
// }}
screenOptions={{ headerMode: 'none' }}
>
<Stack.Screen
options={{ headerShown: false }}
name='Tabs'
component={MyTabs}
/>
</Stack.Navigator>
</NavigationContainer>
Run Code Online (Sandbox Code Playgroud)
标签导航
<Tab.Navigator
useHeaderHeight={false}
screenOptions={
({
headerShown: false,
},
({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === 'Home') {
iconName = focused
? 'ios-information-circle'
: 'ios-information-circle-outline';
} else if (route.name === 'Settings') {
iconName = focused ? 'ios-list' : 'ios-list';
}
// You can return any component that you like here!
return <Ionicons name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: 'tomato',
tabBarInactiveTintColor: 'gray',
}))
}
>
Run Code Online (Sandbox Code Playgroud)
我使用了所有可能的解决方案仍然没有得到答案我想将它与自定义样式一起使用,如图所示
像这样添加
<Stack.Navigator
initialRouteName='OtpScreen'
screenOptions={{
headerShown: false,
}}
screenOptions={{ headerMode: 'none' }}
></Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)
headerShown: false,这会起作用
归档时间: |
|
查看次数: |
7823 次 |
最近记录: |