-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
173 lines (160 loc) · 3.64 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
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image
} from 'react-native';
import {
StackNavigator,
DrawerNavigator,
SwitchNavigator,
DrawerItems
} from 'react-navigation';
import Register from './src/screens/Register';
import Splash from './src/screens/splashScreen'
import Home from './src/screens/Home';
import AddDevice from './src/screens/AddDevice';
import ScanDevice from './src/screens/ScanDevice';
import UserDevices from './src/screens/UserDevices';
import UserDetailDevice from './src/screens/UserDetailDevice';
import Measurement from './src/screens/Measurement';
import Logout from './src/screens/Logout';
import { Provider } from 'react-redux';
import store from './src/store';
export default class App extends Component {
render() {
return (
<Provider store={ store }><RootStack/></Provider>
);
}
}
const CustomDrawerContentComponent = (prop) => {
return (
<View style={{flex: 1}}>
<View style={{paddingBottom: 20, paddingTop:10, borderBottomColor: 'rgba(255, 255, 255, 0.4)', borderBottomWidth: 1, alignItems: 'center'}}>
<Image style={{height: 50, width: 130}} source={require('./src/treki_logo_inline_white.png')} />
<Text style={{fontSize: 15, fontWeight: '300', marginTop: 20, color: '#fff', alignSelf:'flex-start', paddingLeft:20}}> Account: </Text>
<Text style={{fontSize: 20, fontWeight: '600', marginTop: 3, color: '#fff', alignSelf:'flex-start', paddingLeft:20}}> {store.getState().userReducer.email} </Text>
</View>
<DrawerItems {...prop} />
</View>
)
}
const addDeviceStack = StackNavigator(
{
addDevice: {
path: '/adddevice',
screen: AddDevice
},
ScanDevice: {
path: '/scandevice',
screen: ScanDevice
},
},
{
initialRouteName: `ScanDevice`,
headerMode: 'screen',
// navigationOptions: ({ navigation }) => ({
// header: null
// })
}
)
const listDeviceStack = StackNavigator(
{
listUserDevices: {
path:'/listdevice',
screen: UserDevices
},
detailDevice: {
path:'/detaildevice',
screen: UserDetailDevice
},
measurementDevice: {
path: '/measurement',
screen: Measurement
}
},
{
initialRouteName: `listUserDevices`,
headerMode: 'screen',
}
)
const LogoutNav = SwitchNavigator(
{
Logout: {
screen: Logout
}
}
)
const Drawer = DrawerNavigator(
{
Home: {
path: '/',
screen: Home
},
AddDevice: {
screen: addDeviceStack
},
UserDevices: {
screen: listDeviceStack
},
Logout: {
screen: LogoutNav
}
},
{
initialRouteName: 'Home',
drawerPosition: 'left',
drawerBackgroundColor: "#0098a7",
contentComponent: CustomDrawerContentComponent,
contentOptions: {
// activeBackgroundColor: "#02cee5",
activeBackgroundColor: "white",
// activeTintColor: "#00363a",
activeTintColor: "#006971",
inactiveTintColor: "white"
}
}
)
const UserAccess = SwitchNavigator(
{
Splash: {
screen: Splash
},
Register: {
screen: Register
},
},
{
initialRouteName: 'Splash',
headerMode: 'screen',
navigationOptions: ({ navigation }) => ({
header: null
})
}
)
const RootStack = SwitchNavigator(
{
UserAccess: {
screen: UserAccess
},
Home: {
// screen: Drawer
screen: Drawer
}
},
{
initialRouteName: 'UserAccess',
headerMode: 'screen',
navigationOptions: ({ navigation }) => ({
header: null
})
}
)