import { useNavigation } from '@react-navigation/native'
import React, { useContext } from 'react'
import { TouchableOpacity, View } from 'react-native'
import UserContext from '../../../context/User'
import { alignment } from '../../../utils/alignment'
import { NAVIGATION_SCREEN } from '../../../utils/constant'
import { TextDefault } from '../../Text'
import useStyle from './styles'
import i18n from '../../../../i18n'
function DrawerProfile() {
const styles = useStyle()
const navigation = useNavigation()
const { isLoggedIn, loadingProfile, profile } = useContext(UserContext)
if (loadingProfile) return Loading...
return (
{!isLoggedIn && (
{
navigation.navigate(NAVIGATION_SCREEN.CreateAccount)
}}>
{i18n.t('loginOrCreateAcc')}
)}
{isLoggedIn && profile && (
<>
{profile.name.substr(0, 1).toUpperCase()}
{i18n.t('welcome')}
{profile.name}
>
)}
)
}
export default DrawerProfile