import React from 'react'; import { View, Text, ScrollView, TouchableOpacity, Alert } from 'react-native'; import { useAppTheme } from '@theme'; import { PersonIcon, ChevronRightIcon, ClipboardIcon, StarIcon } from '@icons'; import { useAppDispatch, useAppSelector } from '@store'; import { logout } from '@store/commonReducers/auth'; import { useNavigation, CommonActions } from '@react-navigation/native'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import { AppStackParamList } from '@navigation/navigationTypes'; import { RouteNames } from '@utils/constants'; import { getStyles } from './profileScreen.styles'; export const ProfileScreen: React.FC = () => { const { colors } = useAppTheme(); const styles = getStyles(colors); const dispatch = useAppDispatch(); const navigation = useNavigation>(); const { profile } = useAppSelector(state => state.accountInfo); const menuItems = [ { id: 'vehicle', title: 'Vehicle Info', icon: , }, { id: 'documents', title: 'Documents', icon: , route: RouteNames.Documents, }, { id: 'bank', title: 'Bank Details', icon: , route: RouteNames.BankDetails, }, { id: 'emergency', title: 'Emergency Contact', icon: , }, { id: 'settings', title: 'App Settings', icon: , }, ]; const handleMenuPress = (item: any) => { if (item.route) { navigation.navigate(item.route); } else { Alert.alert('Menu Option', `Viewing ${item.title} section...`); } }; const handleLogout = () => { Alert.alert( 'Logout', 'Are you sure you want to log out of SG Delivery Partner?', [ { text: 'Cancel', style: 'cancel' }, { text: 'Logout', style: 'destructive', onPress: () => { dispatch(logout()); // Reset navigation stack to the Auth Stack navigation.dispatch( CommonActions.reset({ index: 0, routes: [{ name: 'Auth' }], }), ); }, }, ], ); }; return ( {/* Header User Card */} {profile?.user?.name} {profile?.rating} {profile?.user?.email} ID: {profile?.user?.id} {/* Profile Menu options */} {menuItems.map((item, idx) => ( handleMenuPress(item)} > {item.icon} {item.title} ))} {/* Logout Button */} Log Out ); }; export default ProfileScreen;