-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
55 lines (51 loc) · 1.61 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
50
51
52
53
54
55
import React, { useState } from "react";
import * as Font from "expo-font";
import { AppLoading } from "expo";
import { HomeStack } from "./routes/homeStack";
import { TimerSession } from "./screens/TimerSession/TimerSession";
import { WorkoutProvider } from "./Context/WorkoutContext";
const getFonts = () => {
return Font.loadAsync({
"nunito-regular": require("./assets/fonts/NunitoSans-Regular.ttf"),
"nunito-semibold": require("./assets/fonts/NunitoSans-SemiBold.ttf"),
"nunito-black": require("./assets/fonts/NunitoSans-Black.ttf"),
"playfair-regular": require("./assets/fonts/PlayfairDisplay-Regular.ttf"),
"playfair-semibold": require("./assets/fonts/PlayfairDisplay-SemiBold.ttf"),
"playfair-black": require("./assets/fonts/PlayfairDisplay-Black.ttf"),
});
};
export default function App() {
// this waits for the font to be loaded before the components
const [fontsLoaded, setFontsLoaded] = useState(false);
const [workoutSettings, setWorkoutSettings] = useState([
{
key: "1",
name: "Yoga Stretch",
metadata: "Streak 15",
duration: "5:30",
exercise: "0:20",
rest: "0:05",
repeat: "10",
},
{
key: "2",
name: "HIIT Workout",
metadata: "Streak 15",
duration: "7:00",
exercise: "0:20",
rest: "0:05",
repeat: "10",
},
]);
if (fontsLoaded) {
return (
<WorkoutProvider value={{ workoutSettings, setWorkoutSettings }}>
<HomeStack />
</WorkoutProvider>
);
} else {
return (
<AppLoading startAsync={getFonts} onFinish={() => setFontsLoaded(true)} />
);
}
}