-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawerComponent.js
111 lines (106 loc) · 3.13 KB
/
DrawerComponent.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
import React from 'react';
import {
TouchableOpacity,
View,
ScrollView,
StyleSheet,
Text,
Alert
} from 'react-native';
import { NavigationActions } from 'react-navigation';
import Auth from '@aws-amplify/auth';
export class DrawerComponent extends React.Component {
navigateToScreen = routeName => {
const navigateAction = NavigationActions.navigate({
routeName: routeName
});
this.props.navigation.dispatch(navigateAction);
};
logout = async () => {
await Auth.signOut()
.then(() => {
console.log('Sign out complete');
this.props.navigation.navigate('Authloading');
})
.catch(err => console.log('Error while signing out!', err));
};
canceledLogout = () => {
console.log('The logout process is now cancelled');
};
logoutAlert = () => {
Alert.alert('Confirm', 'Are you sure that you want to logout?', [
{ text: 'Yes', onPress: () => this.logout() },
{ text: 'No', onPress: () => this.canceledLogout }
]);
};
render() {
styles = StyleSheet.create({
container: {
paddingTop: 40,
flex: 1,
backgroundColor: '#efefef'
},
navItemStyle: {
padding: 12,
},
navItemText:{
fontSize:22
},
navSectionStyle: {
backgroundColor: 'lightgrey'
},
sectionHeadingStyle: {
paddingVertical: 10,
paddingHorizontal: 5
},
footerContainer: {
padding: 20,
backgroundColor: 'lightgrey'
}
});
return (
<View style={styles.container}>
<ScrollView>
<View>
<View style={styles.sectionHeadingStyle}>
<TouchableOpacity
style={styles.navItemStyle}
onPress={() => this.navigateToScreen('Report Tag')}
>
<Text style={styles.navItemText}>Report Tag</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.navItemStyle}
onPress={() => this.navigateToScreen('Tag Log')}
>
<Text style={styles.navItemText}>Tag Log</Text>
</TouchableOpacity>
{/* <TouchableOpacity
style={styles.navItemStyle}
onPress={() => this.navigateToScreen('ImagePickerExample')}
>
<Text style={styles.navItemText}>Images</Text>
</TouchableOpacity> */}
<TouchableOpacity
style={styles.navItemStyle}
onPress={() => this.navigateToScreen('Settings')}
>
<Text style={styles.navItemText}>Settings</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.navItemStyle}
onPress={() => this.logoutAlert()}
>
<Text style={styles.navItemText}>Sign Out</Text>
</TouchableOpacity>
</View>
</View>
</ScrollView>
<View style={styles.footerContainer}>
<Text>Bonefish and Tarpon Trust</Text>
<Text>Tag Reporter</Text>
</View>
</View>
);
}
}