This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathApp.tsx
72 lines (65 loc) · 2.29 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import React, { useState, useEffect } from "react";
import * as Font from "expo-font";
import AppLoading from "expo-app-loading";
import {
useFonts,
SpaceMono_700Bold,
SpaceMono_400Regular,
} from "@expo-google-fonts/space-mono";
import { LogBox } from "react-native";
import Toast from "react-native-toast-message";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { AuthProvider } from "context/authContext";
import AppWrapper from "./AppWrapper";
import { toastLayoutConfig } from "constants/toast";
import "./src/i18n";
import { BottomSheetModalProvider } from "context/bottomSheetModalContext";
import { NotificationsProvider } from "context/notificationsContext";
import { EngineProvider } from "context/engineContext";
import SecureKeychain from "helpers/secureKeychain";
import Config from "react-native-config";
import { ExploreProvider } from "context/exploreContext";
import { CreateProposalProvider } from "context/createProposalContext";
LogBox.ignoreLogs([
"Non-serializable values were found in the navigation state",
]);
let customFonts = {
"Calibre-Medium": require("./assets/font/Calibre-Medium.ttf"),
"Calibre-Semibold": require("./assets/font/Calibre-Semibold.ttf"),
};
async function _loadFontsAsync(setFontsLoaded: (fontsLoaded: boolean) => void) {
await Font.loadAsync(customFonts);
setFontsLoaded(true);
}
export default function App() {
const [fontsLoaded, setFontsLoaded] = useState<boolean>(false);
let [fontLoaded] = useFonts({
SpaceMono_700Bold,
SpaceMono_400Regular,
});
useEffect(() => {
_loadFontsAsync(setFontsLoaded);
SecureKeychain.init(Config.SECURE_KEYCHAIN_SALT);
}, []);
if (fontsLoaded && fontLoaded) {
return (
<SafeAreaProvider>
<CreateProposalProvider>
<EngineProvider>
<AuthProvider>
<ExploreProvider>
<NotificationsProvider>
<BottomSheetModalProvider>
<AppWrapper />
</BottomSheetModalProvider>
</NotificationsProvider>
</ExploreProvider>
</AuthProvider>
</EngineProvider>
</CreateProposalProvider>
<Toast config={toastLayoutConfig} ref={(ref) => Toast.setRef(ref)} />
</SafeAreaProvider>
);
}
return <AppLoading />;
}