-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
75 lines (66 loc) · 1.81 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
import { Provider } from 'react-redux';
import { UIManager } from 'react-native';
import I18n from './src/i18n';
import AppNavigator from './src/screens/Auth/AppNavigator';
import store from './src/redux/store';
import { colors } from './src/util/constants';
import { fontAssets } from './src/util/fontAssets';
import { LoadingScreen } from './src/commons/LoadingScreen'
import Navigator from './src/navigationClient'
// import Navigator from './src/navigation'
const language = [
{ lang: "English", code: "en" },
{ lang: "French", code: "fr" },
{ lang: "Spanish", code: "es" },
]
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
export default class App extends React.Component {
constructor(){
super();
this.state = {
fontLoaded: false,
languages: [],
value: false,
langValue: "en",
select: "Select language"
}
this.onLanguage = this.onLanguage.bind(this);
}
componentDidMount() {
this._loadAssetAsync();
}
onSelectedLang(lang) {
this.setState({
value: false,
select: lang
})
I18n.locale = lang.code;
}
onLanguage() {
this.setState({
value: true
})
}
async _loadAssetAsync() {
await Promise.all(fontAssets);
this.setState({ fontLoaded: true });
}
render(){
if(!this.state.fontLoaded){
return <LoadingScreen size="large" color={colors.GRAY600}/>
}
return (
<Provider store={store}>
<ActionSheetProvider>
<ThemeProvider theme={ colors }>
<Navigator />
</ThemeProvider>
</ActionSheetProvider>
</Provider>
);
}}