import { useNavigation } from '@react-navigation/core'; import React from 'react'; import { StyleSheet } from 'react-native'; import { Avatar, Button, Card, Divider, List, useTheme, } from 'react-native-paper'; import Urls from '../../../constants/Urls'; import { ProfileDataType } from '../../../screens/Amicale/ProfileScreen'; import i18n from 'i18n-js'; type Props = { profile?: ProfileDataType; }; const styles = StyleSheet.create({ card: { margin: 10, }, icon: { backgroundColor: 'transparent', }, editButton: { marginLeft: 'auto', }, mascot: { width: 60, }, title: { marginLeft: 10, }, }); function getFieldValue(field?: string): string { return field ? field : i18n.t('screens.profile.noData'); } export default function ProfilePersonalCard(props: Props) { const { profile } = props; const theme = useTheme(); const navigation = useNavigation(); function getPersonalListItem(field: string | undefined, icon: string) { const title = field != null ? getFieldValue(field) : ':('; const subtitle = field != null ? '' : getFieldValue(field); return ( ( )} /> ); } return ( ( )} /> {i18n.t('screens.profile.personalInformation')} {getPersonalListItem(profile?.birthday, 'cake-variant')} {getPersonalListItem(profile?.phone, 'phone')} {getPersonalListItem(profile?.email, 'email')} {getPersonalListItem(profile?.branch, 'school')} ); }