1 | import React from '@react';
|
2 | import { Provider } from 'react-redux';
|
3 | import { createStore } from 'redux';
|
4 | import { reducer } from './store/index';
|
5 | import './pages/index/index';
|
6 |
|
7 | const store = new createStore(reducer, {
|
8 | value: 12,
|
9 | inputVal: 100
|
10 | });
|
11 |
|
12 | class Global extends React.Component {
|
13 | globalData = {}
|
14 | static config = {
|
15 | window: {
|
16 | navigationBarBackgroundColor: '#00afc7',
|
17 | backgroundTextStyle: 'light',
|
18 | backgroundColor: '#00afc7',
|
19 | navigationBarTitleText: 'nanachi',
|
20 | navigationBarTextStyle: 'white'
|
21 | }
|
22 | };
|
23 | onLaunch() {
|
24 |
|
25 | if (this.$data && typeof global === 'object') {
|
26 | var ref = Object.getPrototypeOf(global) || global;
|
27 | var _this = this;
|
28 | this.globalData = this.$def.globalData;
|
29 | ref.getApp = function() {
|
30 | return _this;
|
31 | };
|
32 | }
|
33 | console.log('App launched');
|
34 | }
|
35 | render() {
|
36 | return <Provider store={store}>{this.props.children}</Provider>
|
37 | }
|
38 | }
|
39 |
|
40 | export default App(new Global());
|