-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
39 lines (34 loc) · 1.01 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
import React, { useState, useEffect } from "react";
import * as Font from "expo-font";
import "dayjs/locale/en-gb";
import { UserProvider } from "./contexts/UserContext";
import { FeedingProvider } from "./contexts/FeedingContext";
import Main from "./components/Main";
import { TimerProvider } from "./contexts/TimerContext";
interface State {
fontLoaded: boolean;
}
const App = () => {
const [fontLoaded, setFontLoaded] = useState<State["fontLoaded"]>(false);
useEffect(() => {
const loadFont = async () => {
await Font.loadAsync({
nunito: require("./assets/fonts/Nunito-Regular.ttf"),
nunitoLight: require("./assets/fonts/Nunito-Light.ttf"),
nunitoSemiBold: require("./assets/fonts/Nunito-SemiBold.ttf")
});
setFontLoaded(true);
};
loadFont();
}, []);
return fontLoaded ? (
<UserProvider>
<TimerProvider>
<FeedingProvider>
<Main />
</FeedingProvider>
</TimerProvider>
</UserProvider>
) : null;
};
export default App;