-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
75 lines (63 loc) · 1.97 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
import * as React from 'react';
import 'expo-dev-client';
import { ActivityIndicator, StyleSheet, View } from "react-native";
import { StatusBar } from 'expo-status-bar';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Provider } from 'react-redux';
import { store, persistor } from './store';
import { PersistGate } from 'reduxjs-toolkit-persist/integration/react'
import useCachedResources from './hooks/useCachedResources';
import Colors from './constants/Colors';
import useColorScheme from './hooks/useColorScheme';
import Navigation from './navigation';
import EngineComponent from './components/EngineComponent';
import * as Localization from 'expo-localization';
import i18n from './constants/i18n';
// testing
// i18n.locale = 'fr-FR';
// i18n.locale = 'en-EN';
// i18n.locale = 'it-IT';
i18n.locale = Localization.locale;
// When a value is missing from a language it'll fallback to another language with the key present.
i18n.enableFallback = true;
function LoadingView() {
const colorScheme = useColorScheme();
const colors = Colors[colorScheme];
return (
<View style={styles.container}>
<ActivityIndicator size='large' color={colors.tint} />
</View>
);
}
export default function App() {
const isLoadingComplete = useCachedResources();
const colorScheme = useColorScheme();
const colors = Colors[colorScheme];
if (!isLoadingComplete) {
return (
<LoadingView />
);
} else {
return (
<Provider store={store}>
<PersistGate loading={<LoadingView />} persistor={persistor}>
<SafeAreaProvider>
<Navigation colorScheme={colorScheme} />
<StatusBar />
<EngineComponent />
</SafeAreaProvider>
</PersistGate>
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
minWidth: '100%',
minHeight: '100%',
flex: 1,
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
},
});