因此,我删除了在选项卡栏中显示主题屏幕的代码。问题是,当我运行该应用程序时,它仍然存在。我尝试清除缓存,删除 .expo 文件夹,然后重新运行应用程序。什么都不起作用。我需要尽快解决这个问题。
import { Tabs } from 'expo-router';
import React from 'react';
import { createStackNavigator } from '@react-navigation/stack';
import { TabBarIcon } from '@/components/navigation/TabBarIcon';
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';
import TopicScreen from './topics';
import DashboardScreen from './dashboard';
export default function stackLayout() {
const Stack = createStackNavigator();
return (
<Stack.Navigator screenOptions={{ headerShown: false }} initialRouteName="topics" >
<Stack.Screen name="topics" options={{ headerShown: false }} component={TopicScreen} />
<Stack.Screen name="tabs" options={{ headerShown: false }} component={TabLayout}/>
</Stack.Navigator>
);
}
export function TabLayout() {
const colorScheme = useColorScheme();
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
headerShown: false,
}}>
<Tabs.Screen
name="dashboard"
options={{
title: 'Dashboard',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'home' : 'home-outline'} color={color} />
),
}}
/>
<Tabs.Screen
name="index"
options={{
title: 'Home',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'home' : 'home-outline'} color={color} />
),
}}
/>
<Tabs.Screen
name="explore"
options={{
title: 'Explore',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'search-circle-sharp' : 'search-circle-outline'} color={color} />
),
}}
/>
</Tabs>
);
}
我也有和你一样的问题。我尝试停止服务器并使用“-c”重新运行它
npx expo start -c
它将清除缓存并重建它,选项卡现在消失了。不过它对我有用。如果我错了请纠正我。