import { View, Text, ScrollView, Pressable, Button, Alert } from 'react-native'; import React, { useContext } from 'react'; import { SafeAreaView } from 'react-native-safe-area-context'; import { router } from 'expo-router'; import { CrossLogoSvg, RightArrowIconSvg } from '../global/SVG'; import { AuthContext, useAuth } from '../../context/AuthProvider'; const AccountSettingPageComponent = () => { const { user } = useContext(AuthContext); const { logout } = useAuth(); const genderText = user?.gender === 'woman' ? '女' : user?.gender === 'man' ? '男' : user?.gender; const handleDeletionAccount = () => { Alert.alert('Delete Account', 'Are you sure you want to delete your account? This action cannot be undone.', [ { text: 'Cancel', style: 'cancel' }, { text: 'Delete', style: 'destructive', onPress: async () => { try { logout(); // await walletService.deleteWallet(user.id); // Handle successful deletion (e.g., logout and redirect) // You might want to add additional logic here } catch (error) { console.error('Error deleting account:', error); Alert.alert('Error', 'Failed to delete account. Please try again.'); } } } ]); }; return ( { router.replace('/accountMainPage'); }} > 帳戶管理 router.push('changeEmailPage')}> 電郵地址 {user?.email} router.push('changePasswordPage')}> 帳戶密碼 ******** router.push('changeNamePage')}> 暱稱 {user?.nickname} router.push('changeGenderPage')}> 性別 {genderText} router.push('changeCarPage')}> 車牌號碼 {user?.car} {/* router.push('changePhonePage')}> 電話號碼 {user?.phone ? `+852 ${user.phone}` : 'No phone number provided'} */} ); }; export default AccountSettingPageComponent;