mirror of
https://github.com/expo/appjs25-eas-update-workshop-code.git
synced 2026-11-15 03:28:09 -10:00
81 lines
2.1 KiB
TypeScript
81 lines
2.1 KiB
TypeScript
import FontAwesome from "@expo/vector-icons/FontAwesome";
|
|
import { useFonts } from "expo-font";
|
|
import { Stack } from "expo-router";
|
|
import { Image } from "expo-image";
|
|
import * as SplashScreen from "expo-splash-screen";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { useEffect } from "react";
|
|
import { View, FlatList, ScrollView } from "react-native";
|
|
import { cssInterop, remapProps } from "nativewind";
|
|
import "../global.css";
|
|
import "react-native-reanimated";
|
|
|
|
// component interops for nativewind - just need these once
|
|
cssInterop(Image, { className: "style" });
|
|
|
|
remapProps(FlatList, {
|
|
className: "style",
|
|
contentContainerClassName: "contentContainerStyle",
|
|
});
|
|
|
|
remapProps(ScrollView, {
|
|
className: "style",
|
|
contentContainerClassName: "contentContainerStyle",
|
|
});
|
|
|
|
export {
|
|
// Catch any errors thrown by the Layout component.
|
|
ErrorBoundary,
|
|
} from "expo-router";
|
|
|
|
export const unstable_settings = {
|
|
// Ensure that reloading on `/modal` keeps a back button present.
|
|
initialRouteName: "(tabs)",
|
|
};
|
|
|
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
|
SplashScreen.preventAutoHideAsync();
|
|
|
|
export default function RootLayout() {
|
|
const [loaded, error] = useFonts({
|
|
SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"),
|
|
...FontAwesome.font,
|
|
});
|
|
|
|
// Expo Router uses Error Boundaries to catch errors in the navigation tree.
|
|
useEffect(() => {
|
|
if (error) throw error;
|
|
}, [error]);
|
|
|
|
useEffect(() => {
|
|
if (loaded) {
|
|
SplashScreen.hideAsync();
|
|
}
|
|
}, [loaded]);
|
|
|
|
if (!loaded) {
|
|
return null;
|
|
}
|
|
|
|
return <RootLayoutNav />;
|
|
}
|
|
|
|
function RootLayoutNav() {
|
|
const queryClient = new QueryClient();
|
|
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<View style={{ flex: 1 }}>
|
|
<Stack
|
|
screenOptions={{
|
|
headerTitle: undefined,
|
|
}}
|
|
>
|
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
<Stack.Screen name="visit" options={{ presentation: "modal" }} />
|
|
</Stack>
|
|
</View>
|
|
</QueryClientProvider>
|
|
);
|
|
}
|