-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
77 lines (68 loc) · 2.25 KB
/
App.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
import React, { Component } from 'react';
import { connect, Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';
import { Root, Drawer } from 'native-base';
import { StackNavigator, addNavigationHelpers, DrawerNavigator } from 'react-navigation';
import Screens from './src/Screens';
import Sidebar from './src/Components/Sidebar/Sidebar';
import AppNavigator from './src/Navigators/AppNavigator';
import {persistor, store } from './src/Storage';
export default class App extends Component {
state = { isReady: false };
nav = undefined;
async componentWillMount() {
await Expo.Font.loadAsync({
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
Ionicons: require("@expo/vector-icons/fonts/Ionicons.ttf")
});
this.setState({ isReady: true });
}
render() {
if (!this.state.isReady) {
return <Expo.AppLoading />;
}
const closeDrawer = () => {
this.drawer._root.close();
};
const openDrawer = () => {
this.drawer._root.open();
};
const dispatchNavigateAction = action => {
this.nav.dispatch(action);
closeDrawer();
};
return (
<Provider store={store}>
<Root>
<Drawer
ref={(ref) => { this.drawer = ref; }}
content={<Sidebar closeDrawer={closeDrawer} dispatch={dispatchNavigateAction} />}
onClose={closeDrawer}>
<AppNavigator
ref={(ref) => { this.nav = ref; }}
screenProps={{ openDrawer }}
/>
</Drawer>
</Root>
</Provider>
);
// return (
// <Provider store={store}>
// <PersistGate persistor={persistor}>
// <Root>
// <Drawer
// ref={(ref) => { this.drawer = ref; }}
// content={<Sidebar closeDrawer={closeDrawer} dispatch={dispatchNavigateAction} />}
// onClose={closeDrawer}>
// <AppNavigator
// ref={(ref) => { this.nav = ref; }}
// screenProps={{ openDrawer }}
// />
// </Drawer>
// </Root>
// </PersistGate>
// </Provider>
// );
}
};