-
Notifications
You must be signed in to change notification settings - Fork 1
/
AccountPage.js
131 lines (122 loc) · 2.53 KB
/
AccountPage.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
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Button,
Image,
KeyboardAvoidingView,
TouchableOpacity,
Alert
} from 'react-native';
import {Permissions, Location, Font} from 'expo';
import firebase from 'firebase';
import FontAwesome, { Icons } from 'react-native-fontawesome';
import { Actions } from 'react-native-router-flux';
import ActionButton from 'react-native-action-button';
export class AccountPage extends Component {
constructor(props) {
super(props);
}
// user log out confirm
logout() {
Alert.alert(
"Are you sure you wish to logout?",
"",
[
{text: 'Cancel'},
{text: 'Yes', onPress: () => {
firebase.auth().signOut().then(function() {
Alert.alert('Signed Out');
Actions.pop();
Actions.pop();
}, function(error) {
Alert.alert('Sign Out Error', error);
});
}},
],
);
}
backtomap() {
console.log("goback");
Actions.pop();
}
// load font after render the page
async componentDidMount() {
await Font.loadAsync({
fontAwesome: require('./fonts/font-awesome-4.7.0/fonts/fontawesome-webfont.ttf'),
});
this.setState({ fontLoaded: true });
}
render() {
return (
<KeyboardAvoidingView
behavior="padding"
style = {styles.container}
>
<TouchableOpacity
style={styles.gobackContainer}
onPress={this.backtomap}>
<Text
style={styles.gobackText}
> Back to map</Text>
</TouchableOpacity>
<View style = {styles.logoContainer}>
<Image
style = {styles.logo}
source = {require('./logo.png')}
/>
<Text style={styles.title}>Free Finder</Text>
</View>
<TouchableOpacity
style={styles.buttonContainer}
onPress={this.logout}>
<Text
style={styles.buttonText}
>Logout</Text>
</TouchableOpacity>
</KeyboardAvoidingView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#3498db',
},
gobackContainer: {
backgroundColor: '#2980b9',
top: '5%',
paddingVertical: 20,
},
gobackText: {
textAlign: 'left',
color: '#FFFFFF',
fontWeight: '700'
},
logo: {
width: 100,
height: 100,
},
logoContainer: {
alignItems: 'center',
flexGrow: 1,
justifyContent: 'center',
},
title: {
color: "#FFF",
marginTop: 10,
textAlign: 'center',
opacity: 0.9,
},
buttonContainer: {
backgroundColor: '#2980b9',
paddingVertical: 15,
},
buttonText: {
textAlign: 'center',
color: '#FFFFFF',
fontWeight: '700'
}
});