-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
103 lines (88 loc) · 2.39 KB
/
main.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/** In order for logging to stream to XDE or the exp CLI you must import the
* exponent module at some point in your app */
import React from 'react';
import Exponent from 'exponent';
import {
AppRegistry,
Platform,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import {
withNavigation,
NavigationProvider,
StackNavigation,
NavigationContext,
createNavigationEnabledStore, NavigationReducer,
DrawerNavigation,
DrawerNavigationItem,
} from '@exponent/ex-navigation';
import {
FontAwesome,
} from '@exponent/vector-icons';
import { MenuContext } from 'react-native-menu';
import { connect, Provider as ReduxProvider } from 'react-redux';
import { combineReducers, createStore } from 'redux';
import makeFlagReducer from 'redux-flag-reducer';
import { Router } from './Router';
let OrgView = require('./OrgView');
const createStoreWithNavigation = createNavigationEnabledStore({
createStore,
navigationStateKey: 'navigation',
});
const OrgStore = createStoreWithNavigation(
combineReducers({
navigation: OrgView.createNavReducer(NavigationReducer),
doc: OrgView.orgAction,
focus: OrgView.focusReducer,
search: OrgView.searchReducer,
side_menu_flag: OrgView.toggleSideMenuReducer
//side_menu_flag: makeFlagReducer(true, false, ['SIDE_MENU_ON'], ['SIDE_MENU_OFF'], 'false')
}));
const navigationContext = new NavigationContext({
router: Router,
store: OrgStore
});
class AppContainer extends React.Component {
render() {
return (
<ReduxProvider store={OrgStore}>
<NavigationProvider context={navigationContext}>
<App />
</NavigationProvider>
</ReduxProvider>
);
}
}
@withNavigation
class App extends React.Component {
state = {
appIsReady: true
}
render() {
return (
<MenuContext style={{ flex: 1 }}>
<View style={styles.container}>
{Platform.OS === 'ios' && <StatusBar barStyle="default" />}
{Platform.OS === 'android' && <View style={styles.statusBarUnderlay} />}
<StackNavigation
id="root"
initialRoute={Router.getRoute('drawer_menu')}
/>
</View>
</MenuContext>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
statusBarUnderlay: {
height: 0,
backgroundColor: 'rgba(0,0,0,0.2)',
},
});
Exponent.registerRootComponent(AppContainer)