I’m new to learning React-Native with Expo, I got a problem when I want to manage my folder structure so I created my folder structure as shown below
And this is the code from app/_layout.tsx
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
import { useFonts } from 'expo-font';
import { Stack } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { useEffect } from 'react';
import 'react-native-reanimated';
import { useColorScheme } from '@/hooks/useColorScheme';
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
export default function RootLayout() {
const colorScheme = useColorScheme();
const [loaded] = useFonts({
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
});
useEffect(() => {
if (loaded) {
SplashScreen.hideAsync();
}
}, [loaded]);
if (!loaded) {
return null;
}
return (
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
<Stack>
<Stack.Screen name="LoginPage/index" options={{ headerShown: false, headerTransparent: true }} />
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="+not-found" options={{ headerShown: false, headerTransparent: true }} />
</Stack>
</ThemeProvider>
);
}
And this is the code from app/(tabs)_layout.tsx
import { Tabs } from 'expo-router';
import React from 'react';
import { TabBarIcon } from '@/components/navigation/TabBarIcon';
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';
export default function TabLayout() {
const colorScheme = useColorScheme();
return (
<Tabs
screenOptions={{
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
headerShown: false,
}}>
<Tabs.Screen
name="DashboardPage/index"
options={{
title: 'Dashboard',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'home' : 'home-outline'} color={color} />
),
}}
/>
<Tabs.Screen
name="MapPage/index"
options={{
title: 'Map',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'map' : 'map-outline'} color={color} />
),
}}
/>
<Tabs.Screen
name="SettingPage/index"
options={{
title: 'Setting',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'settings' : 'settings-outline'} color={color} />
),
}}
/>
<Tabs.Screen
name="ProfilePage/index"
options={{
title: 'Profile',
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'person' : 'person-outline'} color={color} />
),
}}
/>
</Tabs>
);
}
But why does the result always show app/+not-found.tsx
Can anyone help me to solve this problem? or maybe any suggestions on how to create a folder structure on React-Native with Expo for Mobile Apps?