-
Notifications
You must be signed in to change notification settings - Fork 0
/
fullView.js
54 lines (49 loc) · 1.52 KB
/
fullView.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
import React, { Component } from 'react';
import { SafeAreaView, StyleSheet, View } from 'react-native';
import { AppLoading } from 'expo';
import { StatusBar } from 'expo-status-bar';
import { SettingsContext } from './settings/SettingsContext';
import SnakeApp from './index.js';
import * as Font from 'expo-font';
export default class FullView extends Component {
static contextType = SettingsContext;
state = {
isReady: false,
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this.cacheResourcesAsync}
onFinish={() => this.setState({ isReady: true })}
onError={console.warn}
/>
);
}
return (
<View
style={[styles.container, {
backgroundColor: this.context.theme.primary
},
]}
>
<SnakeApp />
<StatusBar
style={this.context.theme.type === 'dark' ? 'light' : 'dark'}
/>
</View>
);
}
async cacheResourcesAsync() {
return Font.loadAsync({
Billy: require('./assets/fonts/Billy/Billy-Regular.ttf'),
'Billy-Bold': require('./assets/fonts/Billy/Billy-Bold.ttf'),
'Billy-Light': require('./assets/fonts/Billy/Billy-Light.ttf'),
})
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});