-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
57 lines (50 loc) · 1.43 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
56
57
import React, { useEffect, useState } from 'react';
import MainScreen from './src/MainScreen';
import { AppContextWrapper } from './src/AppContext';
import { StyleSheet, View, Text, Dimensions } from 'react-native';
import * as Font from 'expo-font';
import Bender from './assets/fonts/Bender.otf';
import BenderBold from './assets/fonts/Bender.bold.otf';
export default App = () => {
const [fontsLoaded, setFontsLoaded] = useState(false);
const loadFonts = async () => {
await Font.loadAsync({
'bender': {
uri: Bender,
display: Font.FontDisplay.SWAP,
},
});
await Font.loadAsync({
'bender-bold': {
uri: BenderBold,
display: Font.FontDisplay.SWAP,
},
});
setFontsLoaded(true);
}
useEffect(() => {
loadFonts();
}, []);
if (!fontsLoaded) {
return (
<View style={styles.loadingView}>
<Text>Loading...</Text>
</View>
);
} else {
return (
<AppContextWrapper>
<MainScreen />
</AppContextWrapper>
);
}
}
const windowWidth = Dimensions.get('window').width;
const windowHeight = Dimensions.get('window').height;
const styles = StyleSheet.create({
loadingView: {
backgroundColor: '#000',
height: windowHeight,
width: windowWidth,
}
});