-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
93 lines (80 loc) · 2.25 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// import { StatusBar } from 'expo-status-bar';
import { useEffect, useCallback } from 'react';
import { Provider } from 'react-redux';
import { RootSiblingParent } from 'react-native-root-siblings';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import { Store } from './src/redux/Store';
import { StyleSheet, SafeAreaView, View, StatusBar } from 'react-native';
import Toolbar from './src/components/Toolbar';
import WordGuesses from './src/components/WordGuesses';
import KeyboardSection from './src/components/KeyboardSection';
import * as COLORS from './src/colors';
export default function App() {
const {
container,
fullContainer,
contentContainer,
guessesContainer
} = styles;
const [fontsLoaded] = useFonts({
'Helvetica': require('./assets/fonts/Helvetica-Neue-W01-66-Medium-It.ttf'),
'Karnak': require('./assets/fonts/karnak-normal-400.ttf'),
});
useEffect(() => {
async function prepare() {
await SplashScreen.preventAutoHideAsync();
}
prepare();
}, []);
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<RootSiblingParent>
<Provider store={Store}>
<SafeAreaView style={container} onLayout={onLayoutRootView}>
<View style={fullContainer}>
<StatusBar barStyle='light-content' />
<Toolbar />
<View style ={contentContainer}>
<View style={guessesContainer}>
<WordGuesses />
</View>
<View>
<KeyboardSection />
</View>
</View>
</View>
</SafeAreaView>
</Provider>
</RootSiblingParent>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: COLORS.BLACK,
},
fullContainer: {
marginTop: StatusBar.currentHeight,
flex: 1,
alignItems: 'center',
justifyContent: 'space-between'
},
contentContainer: {
flex: 1,
marginTop: 30,
alignContent: 'center',
justifyContent: 'space-between',
},
guessesContainer: {
alignContent: 'center',
justifyContent: 'center',
}
});