Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 3b27e0f

Browse files
committed
feat: add image property to Recipient model and display images in AllRecipientsScreen
1 parent 39284b4 commit 3b27e0f

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

src/app/recipients/index.tsx

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@ import {
66
Text,
77
TextInput,
88
View,
9+
Image,
910
} from 'react-native';
1011
import { SafeAreaView } from 'react-native-safe-area-context';
1112
import { useRouter } from 'expo-router';
1213

1314
import { Recipient } from '@/models/Recipient';
1415

1516
const AllRecipientsScreen = () => {
16-
const router = useRouter();
17-
17+
const router = useRouter();
18+
1819
const recipients: Recipient[] = [
19-
{ id: '1', name: 'Alex', budget: 2000, spent: 1500 },
20-
{ id: '2', name: 'Emily', budget: 2200, spent: 1600 },
21-
{ id: '3', name: 'Michael', budget: 3000, spent: 1500 },
22-
{ id: '4', name: 'Malow', budget: 1800, spent: 1200 },
20+
{ id: '1', image:'https://img.freepik.com/premium-vector/cute-boy-smiling-cartoon-kawaii-boy-illustration-boy-avatar-happy-kid_1001605-3445.jpg', name: 'Alex', budget: 2000, spent: 1500 },
21+
{ id: '2', image:'https://static.vecteezy.com/system/resources/previews/004/899/833/non_2x/beautiful-girl-with-blue-hair-avatar-of-woman-for-social-network-vector.jpg', name: 'Emily', budget: 2200, spent: 1600 },
22+
{ id: '3', image:'https://img.freepik.com/premium-vector/boy-with-blue-hoodie-blue-hoodie-with-hoodie-it_1230457-42660.jpg', name: 'Michael', budget: 3000, spent: 1500 },
23+
{ id: '4', image:'https://img.freepik.com/premium-vector/boy-with-hoodie-that-says-hes-boy_1230457-43316.jpg', name: 'Malow', budget: 1800, spent: 1200 },
2324
];
2425

2526
const handleAddRecipient = () => {
2627
router.push('/recipients/add-recipient');
27-
}
28+
};
2829

2930
return (
3031
<SafeAreaView style={styles.container}>
@@ -52,9 +53,15 @@ const AllRecipientsScreen = () => {
5253
<ScrollView style={styles.scrollView}>
5354
{recipients.map((recipient) => (
5455
<Pressable key={recipient.id} style={styles.recipientCard}>
55-
<Text style={styles.recipientName}>{recipient.name}</Text>
56-
<Text style={styles.budgetText}>Budget: ${recipient.budget}</Text>
57-
<Text style={styles.spentText}>Spent: ${recipient.spent}</Text>
56+
<Image
57+
source={{ uri: recipient.image }}
58+
style={styles.recipientImage}
59+
/>
60+
<View style={styles.recipientContent}>
61+
<Text style={styles.recipientName}>{recipient.name}</Text>
62+
<Text style={styles.budgetText}>Budget: ${recipient.budget}</Text>
63+
<Text style={styles.spentText}>Spent: ${recipient.spent}</Text>
64+
</View>
5865
</Pressable>
5966
))}
6067
</ScrollView>
@@ -121,12 +128,22 @@ const styles = StyleSheet.create({
121128
shadowOpacity: 0.1,
122129
shadowRadius: 4,
123130
elevation: 2,
131+
flexDirection: 'row',
132+
alignItems: 'center',
133+
},
134+
recipientImage: {
135+
width: 60,
136+
height: 60,
137+
borderRadius: 8,
138+
},
139+
recipientContent: {
140+
marginLeft: 12,
141+
flex: 1,
124142
},
125143
recipientName: {
126144
fontSize: 18,
127145
fontWeight: '600',
128146
color: '#333333',
129-
marginBottom: 8,
130147
},
131148
budgetText: {
132149
fontSize: 14,

src/models/Recipient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export interface Recipient {
22
id: string;
3-
// image: string;
3+
image: string;
44
name: string;
5+
description?: string;
56
budget: number;
67
spent: number;
78
}

0 commit comments

Comments
 (0)