-
Notifications
You must be signed in to change notification settings - Fork 72
/
routes.js
203 lines (192 loc) · 5.47 KB
/
routes.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import React from 'react';
import PropTypes from 'prop-types';
import {
Image, StyleSheet, ScrollView, SafeAreaView, Platform,
} from 'react-native';
import {
createDrawerNavigator,
DrawerItems,
} from 'react-navigation';
// screens
import Article from './src/screens/Article';
import ArticleCover from './src/screens/ArticleCover';
import Cards from './src/screens/Cards';
import Components from './src/screens/Components';
import Login from './src/screens/Login';
import News from './src/screens/News';
import OrderConfirmed from './src/screens/OrderConfirmed';
import Presentation from './src/screens/Presentation';
import Dashboard from './src/screens/Dashboard';
import Register from './src/screens/Register';
import Registerv2 from './src/screens/Registerv2';
import Grid from './src/screens/Grid';
import theme from './src/theme';
import { Block, Icon, Text } from 'galio-framework';
const GalioDrawer = props => (
<SafeAreaView style={styles.drawer} forceInset={{ top: 'always', horizontal: 'never' }}>
<Block space="between" row style={styles.header}>
<Block flex={0.3}><Image source={{ uri: 'http://i.pravatar.cc/100' }} style={styles.avatar} /></Block>
<Block flex style={styles.middle}>
<Text size={theme.SIZES.FONT * 0.875}>Galio Framework</Text>
<Text muted size={theme.SIZES.FONT * 0.875}>React Native</Text>
</Block>
</Block>
<ScrollView>
<DrawerItems {...props} />
</ScrollView>
</SafeAreaView>
);
const styles = StyleSheet.create({
drawer: {
flex: 1,
},
header: {
paddingHorizontal: theme.SIZES.BASE,
paddingTop: theme.SIZES.BASE * 0.6875,
paddingBottom: theme.SIZES.BASE * 1.6875,
borderBottomColor: '#D8D8D8',
borderBottomWidth: 0.5,
marginTop: Platform.OS === 'android' ? theme.SIZES.BASE * 2 : null,
},
avatar: {
width: theme.SIZES.BASE * 2.5,
height: theme.SIZES.BASE * 2.5,
borderRadius: theme.SIZES.BASE * 1.25,
},
middle: {
justifyContent: 'center',
},
});
const MenuIcon = ({ name, family, focused }) => (
<Icon
name={name}
family={family}
size={theme.SIZES.FONT}
color={focused ? theme.COLORS.WHITE : '#5D5D5D'}
/>
);
MenuIcon.defaultProps = {
name: null,
family: null,
focused: false,
};
MenuIcon.propTypes = {
name: PropTypes.string,
family: PropTypes.string,
focused: PropTypes.bool,
};
const screens = {
Home: {
screen: Components,
navigationOptions: {
drawerLabel: 'Components',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
Cards: {
screen: Cards,
navigationOptions: {
drawerLabel: 'Cards',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
Article: {
screen: Article,
navigationOptions: {
drawerLabel: 'Article Screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
ArticleCover: {
screen: ArticleCover,
navigationOptions: {
drawerLabel: 'Article Cover',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
/*
Dashboard: {
screen: Dashboard,
navigationOptions: {
drawerLabel: 'Dashboard screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
*/
News: {
screen: News,
navigationOptions: {
drawerLabel: 'News Screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
OrderConfirmed: {
screen: OrderConfirmed,
navigationOptions: {
drawerLabel: 'Order Confirmed',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
/*
Presentation: {
screen: Presentation,
navigationOptions: {
drawerLabel: 'Presentation Screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
Login: {
screen: Login,
navigationOptions: {
drawerLabel: 'Login Screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
Register: {
screen: Register,
navigationOptions: {
drawerLabel: 'Register Screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
Registerv2: {
screen: Registerv2,
navigationOptions: {
drawerLabel: 'Register Screen v2',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
Grid: {
screen: Grid,
navigationOptions: {
drawerLabel: 'Grid Screen',
drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />,
},
},
*/
};
const options = {
contentComponent: props => <GalioDrawer {...props} />,
contentOptions: {
labelStyle: {
fontWeight: '500',
color: theme.COLORS.GREY,
fontSize: theme.SIZES.FONT * 0.875,
marginLeft: theme.SIZES.BASE * 0.75,
},
activeLabelStyle: {
color: theme.COLORS.WHITE,
},
activeBackgroundColor: theme.COLORS.THEME,
itemsContainerStyle: {
paddingVertical: 0,
},
iconContainerStyle: {
marginHorizontal: 0,
marginLeft: theme.SIZES.BASE * 1.65,
// marginRight: theme.SIZES.BASE * 0.76,
},
},
};
const GalioApp = createDrawerNavigator(screens, options);
export default GalioApp;