
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import React, {useContext, useEffect} from 'react';
import {
DrawerContentScrollView,
DrawerItemList,
} from '@react-navigation/drawer';
import {View, StyleSheet, Text} from 'react-native';
import Button from './Button';
import {AuthContext} from '../context/AuthContext';
import {BLACK, GRAY} from '../color';
import Icon from 'react-native-vector-icons/FontAwesome';
export default function CustomDrawer(props) {
const {userInfo, setUserToken, setUserInfo} = useContext(AuthContext);
const handleLogout = () => {
// 로그아웃 버튼 클릭 시 로그인 스택으로 이동
setUserInfo(null);
setUserToken(null);
};
return (
<View style={{flex: 1}}>
<DrawerContentScrollView {...props}>
<View style={styles.infoStyle}>
<Icon name="user-circle-o" color={GRAY} size={40} />
<Text style={styles.infoText}>{userInfo?.id}님</Text>
</View>
<DrawerItemList {...props} />
</DrawerContentScrollView>
<View style={styles.logoutStyle}>
<Button title={'로그아웃'} onPress={handleLogout} color={BLACK} />
</View>
</View>
);
}
const styles = StyleSheet.create({
logoutStyle: {
flex: 1,
marginHorizontal: 19,
},
infoStyle: {
paddingTop: 40,
paddingBottom: 20,
// height: 100,
borderBottomWidth: 0.7,
borderColor: GRAY,
justifyContent: 'center',
alignItems: 'center',
},
infoText: {
marginTop: 5,
fontWeight: 'bold',
color: BLACK,
fontSize: 20,
},
});