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
This commit is contained in:
parent
d6e9cde6db
commit
f69fb1e5cf
2 changed files with 53 additions and 5 deletions
|
|
@ -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 = {
|
export {
|
||||||
initialRouteName: '(app)',
|
// 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 (
|
||||||
|
<Stack
|
||||||
|
screenOptions={{
|
||||||
|
headerShown: false,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
22
apps/mobile/metro.config.js
Normal file
22
apps/mobile/metro.config.js
Normal file
|
|
@ -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;
|
||||||
Loading…
Add table
Reference in a new issue