Commit 5561269b authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'prompt-on-logout' into 'master'

Alert when user logs out to prevent accidental logout

See merge request thalia/ThaliApp-react!98
parents c12dc736 b8dbfd13
import React from 'react';
import PropTypes from 'prop-types';
import { Text, View, Image, TouchableHighlight, ImageBackground } from 'react-native';
import { Alert, Text, View, Image, TouchableHighlight, ImageBackground } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import { connect } from 'react-redux';
import Icon from 'react-native-vector-icons/MaterialIcons';
......@@ -13,6 +13,14 @@ import * as profileActions from '../actions/profile';
const background = require('../img/huygens.jpg');
const logoutPrompt = logout => () => Alert.alert(
'Log out?',
'Are you sure you want to log out?',
[{ text: 'Cancel' },
{ text: 'Log out', onPress: logout },
],
);
const Sidebar = (props) => {
const buttons = [
{
......@@ -30,7 +38,7 @@ const Sidebar = (props) => {
scene: 'eventList',
},
{
onPress: props.logout,
onPress: logoutPrompt(props.logout),
iconName: 'lock',
text: 'Uitloggen',
style: {
......
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