Repository navigation
Expand file tree
/
Copy pathApp.js
More file actions
54 lines (50 loc) · 1.54 KB
/
Copy pathApp.js
File metadata and controls
54 lines (50 loc) · 1.54 KB
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 { Provider } from 'react-redux';
import React from 'react';
import { View, ActivityIndicator, StyleSheet } from 'react-native';
import { PersistGate } from 'redux-persist/integration/react';
import { NavigationContainer } from '@react-navigation/native';
import { colors } from './src/styles';
import { store, persistor } from './src/redux/store';
import AppView from './src/modules/AppViewContainer';
import _ from 'lodash'
import RText from './library/RText'
RText.init({
configUrl: 'http://127.0.0.1:3333/cdn/RText.json?a=4'
})
export default function App() {
const navigationRef = React.useRef(null);
return (
<Provider store={store}>
<NavigationContainer
onStateChange={(state, state2) => {
console.log('NavigationContainer state', state)
const routeLength = _.get(state, 'routes.length')
RText.setRoute({
name: _.get(state, `routes[${routeLength - 1}].name`),
params: _.get(state, `routes[${routeLength - 1}].params`)
})
}}
>
<PersistGate
loading={
// eslint-disable-next-line react/jsx-wrap-multilines
<View style={styles.container}>
<ActivityIndicator color={colors.red} />
</View>
}
persistor={persistor}
>
<AppView />
</PersistGate>
</NavigationContainer>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
});