Commit ebf639a4 authored by Jake Howard's avatar Jake Howard
Browse files

Add prompt for logout
parent 50fa5a4a
......@@ -4,9 +4,10 @@ import Icon from 'react-native-vector-icons/FontAwesome';
import token from '../../api/token';
import RouteMaster from '../routes/RouteMaster';
var {
const {
StyleSheet,
TouchableHighlight,
Alert,
View,
Text
} = React;
......@@ -31,6 +32,16 @@ export default class LogoutButton extends React.Component {
token.clear();
this.props.nav.resetTo(RouteMaster.get('LOGIN'));
}
promptLogout() {
Alert.alert(
'Log out?',
'Are you sure you want to log out?',
[
{ text: 'Yes', onPress: this.logout.bind(this) },
{ text: 'No' }
]
)
}
render() {
return (
......@@ -38,7 +49,7 @@ export default class LogoutButton extends React.Component {
<TouchableHighlight
style={styles.toolbarButton}
underlayColor={GlobalStyles.get('CIRCLE_NAVBAR_BG')}
onPress={this.logout.bind(this)}>
onPress={this.promptLogout.bind(this)}>
<Text style={styles.text}><Icon name="sign-out" style={styles.text}/></Text>
</TouchableHighlight>
</View>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment