|
1 | | -import React from "react"; |
| 1 | +import React, { useCallback } from "react"; |
2 | 2 | import { LogBox, StatusBar } from "react-native"; |
3 | 3 | import { GestureHandlerRootView } from "react-native-gesture-handler"; |
4 | 4 | import { SafeAreaProvider } from "react-native-safe-area-context"; |
5 | 5 | import { AdaptUIProvider, Box } from "@adaptui/react-native-tailwind"; |
6 | 6 | import { NavigationContainer } from "@react-navigation/native"; |
| 7 | +import { useFonts } from "expo-font"; |
| 8 | +import * as SplashScreen from "expo-splash-screen"; |
7 | 9 | import tailwind from "twrnc"; |
8 | 10 |
|
9 | 11 | import AppRoot from "./AppRoot"; |
10 | 12 |
|
11 | 13 | LogBox.ignoreAllLogs(); |
12 | 14 |
|
13 | 15 | const AdaptUIApp = () => { |
| 16 | + const [fontsLoaded] = useFonts({ |
| 17 | + "Inter-Black": require("../assets/fonts/Inter-Black.ttf"), |
| 18 | + "Inter-Bold": require("../assets/fonts/Inter-Bold.ttf"), |
| 19 | + "Inter-ExtraBold": require("../assets/fonts/Inter-ExtraBold.ttf"), |
| 20 | + "Inter-ExtraLight": require("../assets/fonts/Inter-ExtraLight.ttf"), |
| 21 | + "Inter-Light": require("../assets/fonts/Inter-Light.ttf"), |
| 22 | + "Inter-Medium": require("../assets/fonts/Inter-Medium.ttf"), |
| 23 | + "Inter-Regular": require("../assets/fonts/Inter-Regular.ttf"), |
| 24 | + "Inter-SemiBold": require("../assets/fonts/Inter-SemiBold.ttf"), |
| 25 | + "Inter-Thin": require("../assets/fonts/Inter-Thin.ttf"), |
| 26 | + }); |
| 27 | + |
| 28 | + const onLayoutRootView = useCallback(async () => { |
| 29 | + if (fontsLoaded) { |
| 30 | + await SplashScreen.hideAsync(); |
| 31 | + } |
| 32 | + }, [fontsLoaded]); |
| 33 | + if (!fontsLoaded) { |
| 34 | + return null; |
| 35 | + } |
14 | 36 | return ( |
15 | | - <Box style={tailwind.style("flex-1")}> |
| 37 | + <Box onLayout={onLayoutRootView} style={tailwind.style("flex-1")}> |
16 | 38 | <StatusBar |
17 | 39 | translucent |
18 | 40 | backgroundColor={"transparent"} |
|
0 commit comments