-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
49 lines (46 loc) · 1.25 KB
/
App.js
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 React, { useEffect, useState } from "react";
import { AppearanceProvider } from "react-native-appearance";
import { NavigationContainer } from "@react-navigation/native";
import { enableScreens } from "react-native-screens";
import AsyncStorage from "@react-native-community/async-storage";
import { useFonts } from "expo-font";
import Main from "./components/Main";
import { UserContext } from "./utils/Context";
enableScreens();
const Usercontext = ({ children }) => {
const [user, setUser] = useState({});
const [button, setButton] = useState();
useEffect(() => {
let x;
try {
AsyncStorage.getItem("@storage_Key").then((response) => {
x = JSON.parse(response);
setUser(x);
});
} catch (e) {
console.log(e);
}
}, []);
return (
<UserContext.Provider value={{ user, setUser, button, setButton }}>
{children}
</UserContext.Provider>
);
};
export default function App() {
const [loaded] = useFonts({
MyText: require("./assets/fonts/Bariol-Regular.ttf"),
});
if (!loaded) {
return null;
}
return (
<AppearanceProvider>
<Usercontext>
<NavigationContainer>
<Main />
</NavigationContainer>
</Usercontext>
</AppearanceProvider>
);
}