-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.android.js
109 lines (90 loc) · 3.11 KB
/
index.android.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
'use strict';
import React, { Component } from 'react';
import {
AppState,
AppRegistry,
StyleSheet,
Text,
View,
Navigator,
TouchableOpacity,
} from 'react-native';
import SplashScreen from './Screens/SplashScreen'
import EventsMenu from './Screens/Events/EventsMenu'
import EventDetails from './Screens/Events/EventDetails'
import EditEvent from './Screens/Events/EditEvent'
import AddEvent from './Screens/Events/AddEvent'
import ActivityHub from './Screens/Activities/ActivitiesHub'
import AddActivity from './Screens/Activities/AddActivity'
import EditActivity from './Screens/Activities/EditActivity'
import ActivityDetails from './Screens/Activities/ActivityDetails'
import SubmitSurvey from './Screens/Surveys/SubmitSurvey'
import ViewSurveys from './Screens/Surveys/ViewSurveys'
import UserManagement from './Screens/User Management/UserManagement'
class TrainingCampApp extends Component{
componentDidMount() {
//AppState.addEventListener('change', this.handleAppStateChange);
}
componentWillUnmount() {
//AppState.removeEventListener('change', this._handleAppStateChange);
}
handleAppStateChange(appState) {
if (appState == 'background') {
console.log("in background");
var PushNotification = require('react-native-push-notification');
PushNotification.configure({
onNotification: function(notification) {
console.log( 'NOTIFICATION:', notification );
},
});
let date = new Date(Date.now());
PushNotification.localNotificationSchedule({
message: "My Notification Message",
date,
});
}
}
_renderScene(route, nav) {
switch (route.screen) {
//Note: have to use {...route.passProps} for passProps in SplashScreen to work properly
case "SplashScreen":
return <SplashScreen navigator={nav} {...route.passProps} />
case "MainMenu":
return <EventsMenu navigator={nav} {...route.passProps} />
case "EventDetails":
return <EventDetails navigator={nav} {...route.passProps} />
case "SubmitSurvey":
return <SubmitSurvey navigator={nav} {...route.passProps} />
case "EditEvent":
return <EditEvent navigator={nav} {...route.passProps} />
case "AddEvent":
return <AddEvent navigator={nav} {...route.passProps} />
case "ActivitiesHub":
return <ActivityHub navigator={nav} {...route.passProps} />
case "AddActivity":
return <AddActivity navigator={nav} {...route.passProps} />
case "EditActivity":
return <EditActivity navigator={nav} {...route.passProps} />
case "ActivityDetails":
return <ActivityDetails navigator={nav} {...route.passProps} />
case "ViewSurveys":
return <ViewSurveys navigator={nav} {...route.passProps} />
case "UserManagement":
return <UserManagement navigator={nav} />
}
}
render() {
return (
<Navigator
initialRoute={{screen: 'SplashScreen'}}
renderScene={(route, nav) => {return this._renderScene(route, nav)}}
configureScene={() => ({
...Navigator.SceneConfigs.FloatFromLeft,
gestures: {},
})
}
/>
)
}
}
AppRegistry.registerComponent('SogetiTrainingCamp', () => TrainingCampApp);