你好,我想添加底部选项卡页内的顶部选项卡 所以我想要屏幕,而不是底部的选项卡标题, 我想要显示可以移动到另一个屏幕的顶部选项卡,
这是我的零食代码屏幕:https://snack.expo.dev/@aza1200/material-top-tabs-navigator-%7C-react-navigation
import * as React from 'react';
import { Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
function FeedScreen() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Feed!</Text>
</View>
);
}
function NotificationsScreen() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Notifications!</Text>
</View>
);
}
const TopTab = createMaterialTopTabNavigator();
const BottomTab = createBottomTabNavigator();
const TopTabNavigator = () => {
<TopTab.Navigator >
<TopTab.Screen name="Post Room" component={FeedScreen} />
<TopTab.Screen name="Rooms" component={NotificationsScreen} />
</TopTab.Navigator>
}
export const App = () => {
return (
<NavigationContainer>
<BottomTab.Navigator screenOptions={{headerShown: false}}>
<TopTab.Screen name="Top Tabs will" component={TopTabNavigator} />
<BottomTab.Screen name="Rooms" component={NotificationsScreen} />
</BottomTab.Navigator>
</NavigationContainer>
)
}
export default App;
这是我的代码和 这将是非常有帮助的,如果有人让我知道如何修复以下代码. 谢谢.