-
Notifications
You must be signed in to change notification settings - Fork 42
/
App.tsx
49 lines (42 loc) · 1.58 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import Router from "@/router";
import { useFonts } from "expo-font";
import { btoaPolyfill, atobPolyfill } from "js-base64";
import * as SplashScreen from "expo-splash-screen";
import { LogBox } from "react-native";
import React, { useEffect } from "react";
import { expoGoWrapper } from "@/utils/native/expoGoAlert";
import AsyncStorage from "@react-native-async-storage/async-storage";
SplashScreen.preventAutoHideAsync();
export default function App () {
const [fontsLoaded, fontError] = useFonts({
light: require("./assets/fonts/FixelText-Light.ttf"),
regular: require("./assets/fonts/FixelText-Regular.ttf"),
medium: require("./assets/fonts/FixelText-Medium.ttf"),
semibold: require("./assets/fonts/FixelText-SemiBold.ttf"),
bold: require("./assets/fonts/FixelText-Bold.ttf"),
});
const applyGlobalPolyfills = () => {
const encoding = require("text-encoding");
Object.assign(global, {
TextDecoder: encoding.TextDecoder,
TextEncoder: encoding.TextEncoder,
atob: atobPolyfill,
btoa: btoaPolyfill
});
};
applyGlobalPolyfills();
useEffect(() => {
LogBox.ignoreLogs([
"[react-native-gesture-handler]",
"VirtualizedLists should never be nested",
"TNodeChildrenRenderer: Support for defaultProps"
]);
// Register background tasks only if not running in the Expo Go app
expoGoWrapper(async () => {
const registerBackgroundTasks = (await import("@/background/BackgroundTasks")).default;
registerBackgroundTasks();
});
}, []);
if (!fontsLoaded && !fontError) return null;
return <Router />;
}