import React from 'react'
import { View, Text, StyleSheet, TextInput, TouchableOpacity, Image, BackHandler } from 'react-native'
import AsyncStorage from '@react-native-async-storage/async-storage';
class LogoutScreen extends React.Component {
state = {
id:null,
selection:null,
name:null,
profile_picture: null,
}
UNSAFE_componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
}
handleBackButton() {
return true;
}
async UNSAFE_componentWillMount() {
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
const id = await AsyncStorage.getItem('id');
const selection = await AsyncStorage.getItem('selection');
const name = await AsyncStorage.getItem('name');
const otp = await AsyncStorage.getItem('otp');
const profile_picture = await AsyncStorage.getItem('profile_picture');
if (id) { this.setState({ id: id }); } else { this.setState({ id: false }); }
if (selection) { this.setState({ selection: selection }); } else { this.setState({ selection: false }); }
if (name) { this.setState({ name: name }); } else { this.setState({ name: false }); }
if (otp) { this.setState({ otp: otp }); } else { this.setState({ otp: false }); }
if (profile_picture) { this.setState({ profile_picture: profile_picture }); } else { this.setState({ profile_picture: false }); }
await AsyncStorage.removeItem('id');
await AsyncStorage.removeItem('selection');
await AsyncStorage.removeItem('name');
await AsyncStorage.removeItem('otp');
await AsyncStorage.removeItem('profile_picture');
this.props.navigation.pop();
this.props.navigation.navigate('Auth');
}
render() {
return (
<View style={{display:'none'}}>
<Text>Logout</Text>
</View>
)
}
}
export default LogoutScreen;