fix(mobile): remove custom font loader causing SIGABRT crash on iOS release
This commit is contained in:
@@ -1,27 +1,11 @@
|
|||||||
import { useEffect } from "react";
|
|
||||||
import { Stack } from "expo-router";
|
import { Stack } from "expo-router";
|
||||||
import { useFonts } from "expo-font";
|
import { StatusBar } from "expo-status-bar";
|
||||||
import Ionicons from "@expo/vector-icons/Ionicons";
|
|
||||||
import * as SplashScreen from "expo-splash-screen";
|
|
||||||
|
|
||||||
SplashScreen.preventAutoHideAsync().catch(() => {});
|
|
||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
const [loaded, error] = useFonts({
|
return (
|
||||||
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"),
|
<StatusBar style="dark" />
|
||||||
...(Ionicons.font || {}),
|
<Stack screenOptions={{ headerShown: false }} />
|
||||||
});
|
</>
|
||||||
|
);
|
||||||
useEffect(() => {
|
|
||||||
if (loaded || error) {
|
|
||||||
SplashScreen.hideAsync().catch(() => {});
|
|
||||||
}
|
|
||||||
}, [loaded, error]);
|
|
||||||
|
|
||||||
if (!loaded && !error) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <Stack screenOptions={{ headerShown: false }} />;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,19 +20,23 @@ export default function Index() {
|
|||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
|
|
||||||
async function resolve() {
|
async function resolve() {
|
||||||
|
try {
|
||||||
const { data } = await supabase.auth.getSession();
|
const { data } = await supabase.auth.getSession();
|
||||||
if (!data.session) {
|
if (!data?.session) {
|
||||||
|
if (!cancelled) {
|
||||||
router.replace("/(auth)/login");
|
router.replace("/(auth)/login");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cached = await getActiveRestaurant();
|
const cached = await getActiveRestaurant();
|
||||||
if (cached) {
|
if (cached) {
|
||||||
|
if (!cancelled) {
|
||||||
router.replace("/menu");
|
router.replace("/menu");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
const { restaurant } = await api.get<MeRestaurantResponse>("/me/restaurant");
|
const { restaurant } = await api.get<MeRestaurantResponse>("/me/restaurant");
|
||||||
const location = restaurant?.locations[0];
|
const location = restaurant?.locations[0];
|
||||||
const menu = location?.menus[0];
|
const menu = location?.menus[0];
|
||||||
@@ -44,14 +48,18 @@ export default function Index() {
|
|||||||
menuId: menu.id,
|
menuId: menu.id,
|
||||||
slug: restaurant.slug,
|
slug: restaurant.slug,
|
||||||
});
|
});
|
||||||
if (!cancelled) router.replace("/menu");
|
if (!cancelled) {
|
||||||
|
router.replace("/menu");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch (e) {
|
||||||
// fall through to onboarding
|
console.warn("Index resolve error:", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cancelled) router.replace("/(onboarding)/restaurant");
|
if (!cancelled) {
|
||||||
|
router.replace("/(onboarding)/restaurant");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve().finally(() => {
|
resolve().finally(() => {
|
||||||
@@ -64,8 +72,8 @@ export default function Index() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
|
<View style={{ flex: 1, alignItems: "center", justifyContent: "center", backgroundColor: "#FAF8F5" }}>
|
||||||
{checking ? <ActivityIndicator /> : null}
|
{checking ? <ActivityIndicator size="large" color="#C8A96B" /> : null}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user