-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.js
45 lines (39 loc) · 1.28 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
import React, { useState } from 'react';
import { View } from 'react-native';
import * as Font from 'expo-font'
import { AppLoading } from 'expo'
import GameContextProvider from './src/contexts/GameContext.js';
import BattleContextProvider from './src/contexts/BattleContext.js';
import Game from './src/Game.js'
import Menu from './src/Menu.js'
import Dictionary from './src/Dictionary.js'
import SoundController from './src/SoundController.js'
import NoteView from './src/NoteView.js'
export default function App() {
const [view, setView] = useState('menu')
const [dataLoaded, setDataLoaded] = useState(false)
const fetchFonts = async () => {
await Font.loadAsync({
'Pixel': require('./assets/fonts/PressStart2P-Regular.ttf')
})
setDataLoaded(true)
}
if (dataLoaded == false) {
fetchFonts();
return <AppLoading />
} else {
return (
<View>
<GameContextProvider>
<BattleContextProvider>
<Menu setView={setView} view={view} />
<Dictionary setView={setView} view={view} />
<Game setView={setView} view={view} />
<SoundController view={view} />
<NoteView view={view} setView={setView} />
</BattleContextProvider>
</GameContextProvider>
</View>
);
}
};