{"size": 2324, "ext": "js", "max_stars_repo_path": "Components/CustomDrawerContentComponent.js", "max_stars_repo_name": "njho/consumerApp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Components/CustomDrawerContentComponent.js", "max_issues_repo_name": "njho/consumerApp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Components/CustomDrawerContentComponent.js", "max_forks_repo_name": "njho/consumerApp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.2083333333, "max_line_length": 101, "alphanum_fraction": 0.5537865749}
import React from 'react';
import {
    StyleSheet,
    Platform,
    Image,
    Text,
    View,
    ScrollView,
    TouchableOpacity,
    Dimensions,
    AsyncStorage
} from 'react-native';
import {
    SwitchNavigator,
    createStackNavigator,
    StackNavigator,
    createDrawerNavigator,
    DrawerItems,
    SafeAreaView
} from 'react-navigation';
import firebase from 'react-native-firebase';
import Icon from 'react-native-vector-icons/Ionicons';


const height = Dimensions.get('window').height;

const logout = (props) => {
    console.log(props);
    firebase.auth().signOut();
    props.navigation.navigate('Loading');

};

class CustomDrawerContentComponent extends React.Component {
    constructor() {
        super();
        this.state = {
            // firebase things?
        };
    }

    logout = () => {
        firebase.auth().signOut().then(() => {
                // AsyncStorage.clear();
                this.props.navigation.navigate('Loading');
                AsyncStorage.removeItem('userToken');
            }
        );
    };

    render() {
        return <ScrollView style={{height: height}}>
            <SafeAreaView style={styles.container} forceInset={{top: 'always', horizontal: 'never'}}>
                <DrawerItems {...this.props} />
                <View style={styles.bottomButtons}>
                    <TouchableOpacity style={styles.menuRow} onPress={() => this.logout()}>
                        <Icon style={{marginHorizontal: 25}} name="ios-log-out" size={25}/>
                        <Text style={[styles.logoutText]}>Logout</Text>
                    </TouchableOpacity>
                </View>
            </SafeAreaView>
        </ScrollView>
    }

}

export default CustomDrawerContentComponent;

const styles = StyleSheet.create({
    container: {
        flex: 1,
        height: height * 0.95,
    },
    bottomButtons: {
        position: 'absolute',
        bottom: 10,
        flexDirection: 'column',
        justifyContent: 'center',
        alignItems: 'center',
        flex: 1,
        alignSelf: 'stretch'
    },
    menuRow: {
        flexDirection: 'row',
        alignSelf: 'stretch',
        paddingVertical: 10,
        flex: 1,
        alignItems: 'center'
    },
    logoutText: {
        fontWeight: 'bold',
        color: 'black'
    }
});

