From f69fb1e5cff87c101713e904c9b2bdd87f8a66c8 Mon Sep 17 00:00:00 2001 From: bananabas Date: Sat, 28 Mar 2026 07:40:29 +0000 Subject: [PATCH] fix: configure metro and App entry for Expo Go dev server - Updated App.tsx to use proper Stack navigation - Created ESM-compatible metro.config.js - Fixed module resolution for monorepo structure - Dev server now starts successfully Ready to test on physical devices via Expo Go app --- apps/mobile/App.tsx | 36 +++++++++++++++++++++++++++++++----- apps/mobile/metro.config.js | 22 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 apps/mobile/metro.config.js diff --git a/apps/mobile/App.tsx b/apps/mobile/App.tsx index a8e5341..fbf74ce 100644 --- a/apps/mobile/App.tsx +++ b/apps/mobile/App.tsx @@ -1,7 +1,33 @@ -import { ExpoRoot } from 'expo-router'; +import { useFonts } from 'expo-font'; +import { SplashScreen, Stack } from 'expo-router'; +import { useEffect } from 'react'; -export const unstable_settings = { - initialRouteName: '(app)', -}; +export { + // Catch any errors thrown by the Layout component. + ErrorBoundary, +} from 'expo-router'; -export default ExpoRoot; +// Prevent the splash screen from auto-hiding before asset loading is complete. +SplashScreen.preventAutoHideAsync(); + +export default function RootLayout() { + const [fontsLoaded, fontError] = useFonts({}); + + useEffect(() => { + if (fontsLoaded || fontError) { + SplashScreen.hideAsync(); + } + }, [fontsLoaded, fontError]); + + if (!fontsLoaded && !fontError) { + return null; + } + + return ( + + ); +} diff --git a/apps/mobile/metro.config.js b/apps/mobile/metro.config.js new file mode 100644 index 0000000..c799b87 --- /dev/null +++ b/apps/mobile/metro.config.js @@ -0,0 +1,22 @@ +import { getDefaultConfig } from 'expo/metro-config.js'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const projectRoot = __dirname; +const monorepoRoot = path.resolve(projectRoot, '../..'); + +const config = getDefaultConfig(projectRoot); + +// Extend the resolver to handle monorepo +config.resolver.sourceExts = ['ts', 'tsx', 'js', 'jsx', 'json', 'mjs']; +config.resolver.extraNodeModules = { + '@shop/types': path.resolve(monorepoRoot, 'packages/types'), +}; + +// Ensure app root is correct +config.projectRoot = projectRoot; + +export default config;