-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
executable file
·182 lines (161 loc) · 4.13 KB
/
App.js
File metadata and controls
executable file
·182 lines (161 loc) · 4.13 KB
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
import React from 'react';
import { AppLoading, Asset, Font } from 'expo';
import FitexpressHome from './screens/fitexpress/home/home'
import FitexpressGallery from './screens/fitexpress/gallery/gallery'
import Join from './screens/fitexpress/join/join'
import Contact from './screens/fitexpress/contact/contact'
import About from './screens/fitexpress/about/about'
import BodytecHome from './screens/bodytec/home/home'
import BodytecGallery from './screens/bodytec/gallery/gallery'
import { StyleSheet, Text, View, Image, StatusBar, ImageBackground, TouchableHighlight, Dimensions, Platform, PixelRatio } from 'react-native';
import { DrawerNavigator, StackNavigator } from 'react-navigation';
import CustomDrawerBodytec from './CustomDrawerBodytec'
import CustomDrawerFitexpress from './CustomDrawerFitexpress'
const StackFitexpress = {
FitexpressHome: {
screen: FitexpressHome
},
Join: {
screen: Join
},
FitexpressGallery: {
screen: FitexpressGallery
},
Contact: {
screen: Contact
},
About: {
screen: About
}
};
const StackBodytec = {
BodytecHome: {
screen: BodytecHome
},
Join: {
screen: Join
},
BodytecGallery: {
screen: BodytecGallery
},
Contact: {
screen: Contact
},
About: {
screen: About
}
};
const DrawerRoutesFitexpress = {
HomeStack: {
screen: StackNavigator(StackFitexpress, { initialRouteName: 'FitexpressHome', })
},
galleryStack: {
screen: StackNavigator(StackFitexpress, { initialRouteName: 'FitexpressGallery' })
},
joinStack: {
screen: StackNavigator(StackFitexpress, { initialRouteName: 'Join' })
},
contactStack: {
screen: StackNavigator(StackFitexpress, { initialRouteName: 'Contact' })
},
aboutStack: {
screen: StackNavigator(StackFitexpress, { initialRouteName: 'About' })
}
};
const DrawerRoutesBodytec = {
HomeStack: {
screen: StackNavigator(StackBodytec, { initialRouteName: 'BodytecHome', })
},
galleryStack: {
screen: StackNavigator(StackBodytec, { initialRouteName: 'BodytecGallery' })
},
joinStack: {
screen: StackNavigator(StackBodytec, { initialRouteName: 'Join' })
},
contactStack: {
screen: StackNavigator(StackBodytec, { initialRouteName: 'Contact' })
},
aboutStack: {
screen: StackNavigator(StackBodytec, { initialRouteName: 'About' })
}
};
const RootNavigator = StackNavigator({
fitexpress: {
screen: StackNavigator({
Drawer: {
name: 'Drawer',
screen: DrawerNavigator(DrawerRoutesFitexpress,{
contentComponent: CustomDrawerFitexpress,
drawerPosition: 'right'
}
),
},
...StackFitexpress
},{headerMode: 'none'})
},
Bodytec: {
screen: StackNavigator({
Drawer: {
name: 'Drawer',
screen: DrawerNavigator(DrawerRoutesBodytec,{
contentComponent: CustomDrawerBodytec,
drawerPosition: 'right'
}
),
},
...StackBodytec
},{headerMode: 'none'})
}
},
{
headerMode: 'none',
}
);
function cacheImages(images) {
return images.map(image => {
if (typeof image === 'string') {
return Image.prefetch(image);
} else {
return Asset.fromModule(image).downloadAsync();
}
});
}
function cacheFonts(fonts) {
return fonts.map(font => Font.loadAsync(font));
}
export default class App extends React.Component {
state = {
isReady: false,
current: "fit"
};
async _loadAssetsAsync() {
const imageAssets = cacheImages([
require('./assets/main-bg.png'),
require('./assets/logo.png'),
require('./assets/back2-mdpi.png'),
require('./assets/back-mdpi.png')
]);
const fontAssets = cacheFonts([
{"Arial": require("./fonts/arial.ttf")},
{"NeoSansArabic": require("./fonts/NeoSansArabic.ttf")}
]);
await Promise.all([...imageAssets, ...fontAssets]);
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this._loadAssetsAsync}
onFinish={() => {
this.setState({ isReady: true })
}}
onError={console.warn}
/>
);
}
return (
<RootNavigator
ref={nav => { this.navigator = nav; }} />
);
}
}