diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx
index d272600..c0bd57d 100644
--- a/apps/mobile/src/app/_layout.tsx
+++ b/apps/mobile/src/app/_layout.tsx
@@ -1,27 +1,11 @@
-import { useEffect } from "react";
import { Stack } from "expo-router";
-import { useFonts } from "expo-font";
-import Ionicons from "@expo/vector-icons/Ionicons";
-import * as SplashScreen from "expo-splash-screen";
-
-SplashScreen.preventAutoHideAsync().catch(() => {});
+import { StatusBar } from "expo-status-bar";
export default function RootLayout() {
- const [loaded, error] = useFonts({
- Ionicons: require("@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Ionicons.ttf"),
- ionicons: require("@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/Ionicons.ttf"),
- ...(Ionicons.font || {}),
- });
-
- useEffect(() => {
- if (loaded || error) {
- SplashScreen.hideAsync().catch(() => {});
- }
- }, [loaded, error]);
-
- if (!loaded && !error) {
- return null;
- }
-
- return ;
+ return (
+ <>
+
+
+ >
+ );
}
diff --git a/apps/mobile/src/app/index.tsx b/apps/mobile/src/app/index.tsx
index 266b4a0..7c01cf8 100644
--- a/apps/mobile/src/app/index.tsx
+++ b/apps/mobile/src/app/index.tsx
@@ -20,19 +20,23 @@ export default function Index() {
let cancelled = false;
async function resolve() {
- const { data } = await supabase.auth.getSession();
- if (!data.session) {
- router.replace("/(auth)/login");
- return;
- }
-
- const cached = await getActiveRestaurant();
- if (cached) {
- router.replace("/menu");
- return;
- }
-
try {
+ const { data } = await supabase.auth.getSession();
+ if (!data?.session) {
+ if (!cancelled) {
+ router.replace("/(auth)/login");
+ }
+ return;
+ }
+
+ const cached = await getActiveRestaurant();
+ if (cached) {
+ if (!cancelled) {
+ router.replace("/menu");
+ }
+ return;
+ }
+
const { restaurant } = await api.get("/me/restaurant");
const location = restaurant?.locations[0];
const menu = location?.menus[0];
@@ -44,14 +48,18 @@ export default function Index() {
menuId: menu.id,
slug: restaurant.slug,
});
- if (!cancelled) router.replace("/menu");
+ if (!cancelled) {
+ router.replace("/menu");
+ }
return;
}
- } catch {
- // fall through to onboarding
+ } catch (e) {
+ console.warn("Index resolve error:", e);
}
- if (!cancelled) router.replace("/(onboarding)/restaurant");
+ if (!cancelled) {
+ router.replace("/(onboarding)/restaurant");
+ }
}
resolve().finally(() => {
@@ -64,8 +72,8 @@ export default function Index() {
}, []);
return (
-
- {checking ? : null}
+
+ {checking ? : null}
);
}