fix: make the web bundle run and repair broken route declarations
- add babel.config.js with unstable_transformImportMeta: zustand/middleware ships import.meta.env, which the Metro web bundle (a classic script) cannot parse, so every page threw 'SyntaxError: Cannot use import.meta outside a module' and the app never hydrated after the static export. - declare the settings screen as 'settings/index' in the root stack: the old name 'settings' matched no route, so the modal presentation and the 'Settings' title were silently dropped (expo-router logged 'No route named settings exists'). - add the missing app/+not-found.tsx that the root layout already referenced. - update the About label from LocalAiApp to LocalMind.
This commit is contained in:
1 parent
ac215b4229
commit
4cc1addb3c
4 files changed
+56
-2
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { Link, Stack } from 'expo-router';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
|
||||
export default function NotFoundScreen() {
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen options={{ title: 'Oops!' }} />
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>This screen does not exist.</Text>
|
||||
|
||||
<Link href="/" style={styles.link}>
|
||||
<Text style={styles.linkText}>Go to home screen</Text>
|
||||
</Link>
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 20,
|
||||
},
|
||||
title: {
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
link: {
|
||||
marginTop: 15,
|
||||
paddingVertical: 15,
|
||||
},
|
||||
linkText: {
|
||||
fontSize: 14,
|
||||
color: '#2e78b7',
|
||||
},
|
||||
});
|
||||
+1
-1
@@ -28,7 +28,7 @@ export default function RootLayout() {
|
||||
<Stack>
|
||||
<Stack.Screen name="index" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="chat" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="settings" options={{ presentation: 'modal', title: 'Settings' }} />
|
||||
<Stack.Screen name="settings/index" options={{ presentation: 'modal', title: 'Settings' }} />
|
||||
<Stack.Screen name="+not-found" />
|
||||
</Stack>
|
||||
<StatusBar style={isDark ? 'light' : 'dark'} />
|
||||
|
||||
@@ -215,7 +215,7 @@ export default function SettingsScreen() {
|
||||
<View style={[styles.card, { backgroundColor: colors.cardBackground, borderColor: colors.border }]}>
|
||||
<View style={styles.rowGroup}>
|
||||
<Info size={18} color={colors.textMuted} style={styles.infoIcon} />
|
||||
<Text style={[styles.infoText, { color: colors.text }]}>LocalAiApp - Cross Platform Version</Text>
|
||||
<Text style={[styles.infoText, { color: colors.text }]}>LocalMind - Cross Platform Version</Text>
|
||||
</View>
|
||||
<View style={[styles.rowGroup, { marginTop: 8 }]}>
|
||||
<MonitorCog size={18} color={colors.textMuted} style={styles.infoIcon} />
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
module.exports = function (api) {
|
||||
api.cache(true);
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
'babel-preset-expo',
|
||||
{
|
||||
// Dependencias (zustand/middleware) usam `import.meta.env`, que nao existe
|
||||
// no bundle web do Metro (script classico) e quebrava a hidratacao do app.
|
||||
// O polyfill do Expo troca por `globalThis.__ExpoImportMetaRegistry`.
|
||||
unstable_transformImportMeta: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user