-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
46 lines (42 loc) · 1.09 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
40
41
42
43
44
45
46
import React, { useState, useEffect } from 'react';
import * as Font from 'expo-font';
import { DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
import { View, StyleSheet } from 'react-native';
import Constants from 'expo-constants';
import { AppContainer } from './src/Navigation';
import { dark, blue } from './src/styled/colors';
const styles = StyleSheet.create({
statusBar: {
backgroundColor: dark,
height: Constants.statusBarHeight,
},
});
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: dark,
accent: blue,
},
};
interface State {
fontLoaded: boolean;
}
export default function App() {
const [fontLoaded, setFontLoaded] = useState<State['fontLoaded']>(false);
useEffect(() => {
const loadFont = async () => {
await Font.loadAsync({
oswald: require('./assets/fonts/Oswald.ttf'),
});
setFontLoaded(true);
};
loadFont();
});
return (
<PaperProvider theme={theme}>
<View style={styles.statusBar} />
{fontLoaded ? <AppContainer /> : null}
</PaperProvider>
);
}