-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
44 lines (33 loc) · 1.13 KB
/
index.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
import React, {Component} from 'react';
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';
import AppNavigator from './src/navigator/AppNavigator';
import {createAppContainer} from 'react-navigation';
import {Provider} from 'react-redux';
import configureStore from './src/redux/store';
import { PersistGate } from 'redux-persist/integration/react';
import { ThemeProvider } from 'react-native-elements';
const AppStackNavigatorContainer = createAppContainer(AppNavigator);
const { persistor, store } = configureStore();
const theme = {
colors: {
primary: '#ff6c00',
},
Button: {
titleStyle: {
color: '#fff',
},
},
};
const ReduxApp = () => (
// 配置 Provider 为根组件,同时传入 store 作为其属性
<Provider store={store}>
<PersistGate persistor={persistor}>
<ThemeProvider theme={theme}>
{/* redux 持久化存储 */}
<AppStackNavigatorContainer />
</ThemeProvider>
</PersistGate>
</Provider>
);
AppRegistry.registerComponent(appName, () => ReduxApp);