-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.osx.js
64 lines (41 loc) · 1.48 KB
/
index.osx.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
/**
* Sample React Native Desktop App
* https://github.com/ptmt/react-native-desktop
*/
'use strict';
import React, {AppRegistry, StyleSheet, Text, View, Dimensions, TouchableHighlight} from 'react-native';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
import storage from 'redux-storage';
import createEngine from './rndesktopStorage';
import { promiseMiddleware } from './middlewares/middleware'
import reducer from './reducers';
import { SIGNIN_REQUEST, SIGNIN_FAILURE } from './actions';
import App from './components/App';
const engine = createEngine('inspector');
const wrappedReducer = storage.reducer(reducer);
const storageMiddleware = storage.createMiddleware(engine, [ SIGNIN_REQUEST, SIGNIN_FAILURE ]);
const middleware = process.env.NODE_ENV === 'production' ?
[ thunk, storageMiddleware, promiseMiddleware ] :
[ thunk, logger(), storageMiddleware, promiseMiddleware ];
const createStoreWithMiddleware = applyMiddleware(...middleware)(createStore);
const store = createStoreWithMiddleware(wrappedReducer);
export default class inspector extends React.Component {
constructor() {
super();
}
componentWillMount() {
const load = storage.createLoader(engine);
load(store);
}
render() {
return (
<Provider store={store}>
<App />
</Provider>
);
}
}
AppRegistry.registerComponent('inspector', () => inspector);