-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
196 lines (187 loc) · 4.95 KB
/
index.ios.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
'use strict';
import {
AppRegistry,
StyleSheet,
Text,
View,
Navigator,
TouchableOpacity,
} from "react-native";
import React, {Component} from "react";
import OneSignal from 'react-native-onesignal';
var RideApplLogin = require('./App/App');
var Register = require('./App/Register');
var Tabs = require('./App/Tabs');
var RidesPage = require("./App/RidesPage");
var GroupsPage = require("./App/GroupsPage");
var GroupDetails = require("./App/GroupDetails");
var RideSeek = require("./App/RideSeek");
var RideResults = require("./App/rideresults");
var SettingsPage = require("./App/SettingsPage");
var AddGroup = require("./App/AddGroup");
var LeaveGroup = require("./App/LeaveGroup");
var CreateGroup = require("./App/CreateGroup");
var GroupMgmt = require("./App/GroupMgmt");
var GroupMgmtOptions = require("./App/GroupMgmtOptions");
var AddEvent = require("./App/AddEvent");
var MemberMgmt = require("./App/MemberMgmt");
var MemberEdit = require("./App/MemberEdit");
class App extends Component {
render() {
OneSignal.enableInAppAlertNotification(true);
OneSignal.setSubscription(true);
var pendingNotifications = [];
OneSignal.configure({
onIdsAvailable: function(device) {
console.log('UserId = ', device.userId);
console.log('PushToken = ', device.pushToken);
},
onNotificationOpened: function(message, data, isActive) {
var notification = {message: message, data: data, isActive: isActive};
console.log('NOTIFICATION OPENED: ', notification);
pendingNotifications.push(notification);
handleNotification(notification);
}
});
return (
<Navigator
initialRoute={{id: 'LoginPage', name: 'Index'}}
renderScene={this.renderScene.bind(this)}
configureScene={(route) => {
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FloatFromRight;
}} />
);
}
renderScene(route, navigator) {
var routeId = route.id;
if (routeId === 'LoginPage') {
return (
<RideApplLogin
navigator={navigator} />
);
}
if (routeId === "MemberEdit") {
return (
<MemberEdit
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "MemberMgmt") {
return (
<MemberMgmt
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "AddEvent") {
return (
<AddEvent
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "GroupMgmtOptions") {
return (
<GroupMgmtOptions
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "GroupMgmt") {
return (
<GroupMgmt
navigator = {navigator} {...route.passProps}/>
);
}
if (routeId === "CreateGroup") {
return (
<CreateGroup
navigator={navigator} />
);
}
if (routeId === "LeaveGroup") {
return (
<LeaveGroup
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "AddGroup") {
return (
<AddGroup
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "RideResults") {
return (
<RideResults
navigator={navigator} />
);
}
if (routeId === "RideSeek") {
return (
<RideSeek
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "GroupDetails") {
return (
<GroupDetails
navigator= {navigator} {...route.passProps} />
);
}
if (routeId === 'Tabs') {
return (
<Tabs
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === 'Register') {
return (
<Register
navigator={navigator} />
);
}
if (routeId === "Rides") {
return (
<RidesPage
navigator={navigator} {...route.passProps}/>
);
}
if (routeId === "Groups") {
return (
<GroupsPage
navigator={navigator} {...route.passProps}/>
);
}
return this.noRoute(navigator);
}
noRoute(navigator) {
return (
<View style={{flex: 1, alignItems: 'stretch', justifyContent: 'center'}}>
<TouchableOpacity style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}
onPress={() => navigator.pop()}>
<Text style={{color: 'red', fontWeight: 'bold'}}> Oops! </Text>
</TouchableOpacity>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('RideApp', () => App);