@umituz/react-native-design-system 2.6.94 → 2.6.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/atoms/AtomicAvatar.README.md +284 -397
- package/src/atoms/AtomicBadge.README.md +123 -358
- package/src/atoms/AtomicCard.README.md +358 -247
- package/src/atoms/AtomicDatePicker.README.md +127 -332
- package/src/atoms/AtomicFab.README.md +194 -352
- package/src/atoms/AtomicIcon.README.md +241 -274
- package/src/atoms/AtomicProgress.README.md +100 -338
- package/src/atoms/AtomicSpinner.README.md +304 -337
- package/src/atoms/AtomicText.README.md +153 -389
- package/src/atoms/AtomicTextArea.README.md +267 -268
- package/src/atoms/EmptyState.README.md +247 -292
- package/src/atoms/GlassView/README.md +313 -444
- package/src/atoms/button/README.md +186 -297
- package/src/atoms/button/STRATEGY.md +252 -0
- package/src/atoms/chip/README.md +242 -290
- package/src/atoms/input/README.md +296 -290
- package/src/atoms/picker/README.md +278 -309
- package/src/atoms/skeleton/AtomicSkeleton.README.md +394 -252
- package/src/molecules/BaseModal/README.md +356 -0
- package/src/molecules/BaseModal.README.md +324 -200
- package/src/molecules/ConfirmationModal.README.md +349 -302
- package/src/molecules/Divider/README.md +293 -376
- package/src/molecules/FormField.README.md +321 -534
- package/src/molecules/GlowingCard/GlowingCard.tsx +1 -1
- package/src/molecules/GlowingCard/README.md +230 -372
- package/src/molecules/List/README.md +281 -488
- package/src/molecules/ListItem.README.md +320 -315
- package/src/molecules/SearchBar/README.md +332 -430
- package/src/molecules/StepHeader/README.md +311 -411
- package/src/molecules/StepProgress/README.md +281 -448
- package/src/molecules/alerts/README.md +272 -355
- package/src/molecules/avatar/README.md +295 -356
- package/src/molecules/bottom-sheet/README.md +303 -340
- package/src/molecules/calendar/README.md +301 -265
- package/src/molecules/countdown/README.md +347 -456
- package/src/molecules/emoji/README.md +281 -514
- package/src/molecules/listitem/README.md +307 -399
- package/src/molecules/media-card/MediaCard.tsx +31 -34
- package/src/molecules/media-card/README.md +217 -319
- package/src/molecules/navigation/README.md +263 -284
- package/src/molecules/navigation/components/NavigationHeader.tsx +77 -0
- package/src/molecules/navigation/index.ts +1 -0
- package/src/molecules/splash/README.md +76 -80
- package/src/molecules/swipe-actions/README.md +376 -588
|
@@ -1,431 +1,370 @@
|
|
|
1
|
-
# Avatar
|
|
1
|
+
# Avatar
|
|
2
2
|
|
|
3
|
-
Avatar
|
|
3
|
+
Avatar is an advanced component for displaying user profile images with support for initials, icon fallbacks, and online status indicators.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Import & Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- 🎭 **İkon Fallback**: Fallback ikon desteği
|
|
10
|
-
- 🟢 **Status Indicator**: Online/offline durumu
|
|
11
|
-
- 📏 **5 Size**: xs, sm, md, lg, xl
|
|
12
|
-
- 🔲 **2 Shape**: Circle, Square
|
|
13
|
-
- 🎨 **Özelleştirilebilir**: Renk ve stil
|
|
14
|
-
- 👆 **Pressable**: Tıklanabilir avatar
|
|
15
|
-
|
|
16
|
-
## Kurulum
|
|
17
|
-
|
|
18
|
-
```tsx
|
|
19
|
-
import { Avatar } from 'react-native-design-system';
|
|
7
|
+
```typescript
|
|
8
|
+
import { Avatar } from 'react-native-design-system/src/molecules/avatar';
|
|
20
9
|
```
|
|
21
10
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
import React from 'react';
|
|
26
|
-
import { View } from 'react-native';
|
|
27
|
-
import { Avatar } from 'react-native-design-system';
|
|
28
|
-
|
|
29
|
-
export const BasicExample = () => {
|
|
30
|
-
return (
|
|
31
|
-
<View style={{ padding: 16 }}>
|
|
32
|
-
<Avatar
|
|
33
|
-
uri="https://example.com/avatar.jpg"
|
|
34
|
-
size="md"
|
|
35
|
-
/>
|
|
36
|
-
</View>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
```
|
|
11
|
+
**Location:** `src/molecules/avatar/Avatar.tsx`
|
|
40
12
|
|
|
41
|
-
## Basic
|
|
13
|
+
## Basic Usage
|
|
42
14
|
|
|
43
15
|
```tsx
|
|
44
|
-
{/* Resim ile */}
|
|
45
16
|
<Avatar
|
|
46
17
|
uri="https://example.com/avatar.jpg"
|
|
47
18
|
size="md"
|
|
48
19
|
/>
|
|
20
|
+
```
|
|
49
21
|
|
|
50
|
-
|
|
51
|
-
<Avatar
|
|
52
|
-
name="Ahmet Yılmaz"
|
|
53
|
-
size="md"
|
|
54
|
-
/>
|
|
22
|
+
## Strategy
|
|
55
23
|
|
|
56
|
-
|
|
57
|
-
<Avatar
|
|
58
|
-
icon="person-outline"
|
|
59
|
-
size="md"
|
|
60
|
-
/>
|
|
61
|
-
```
|
|
24
|
+
**Purpose**: Provide a flexible, accessible avatar component that handles various content types (images, initials, icons) with consistent styling.
|
|
62
25
|
|
|
63
|
-
|
|
26
|
+
**When to Use**:
|
|
27
|
+
- User profile pictures
|
|
28
|
+
- Team member displays
|
|
29
|
+
- Chat/conversation lists
|
|
30
|
+
- User selectors
|
|
31
|
+
- Online status indicators
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<Avatar name="A" size="md" />
|
|
70
|
-
<Avatar name="A" size="lg" />
|
|
71
|
-
<Avatar name="A" size="xl" />
|
|
72
|
-
</View>
|
|
73
|
-
```
|
|
33
|
+
**When NOT to Use**:
|
|
34
|
+
- For decorative images - use Image component
|
|
35
|
+
- For logos/branding - use dedicated logo component
|
|
36
|
+
- For complex graphics - use custom component
|
|
74
37
|
|
|
75
|
-
##
|
|
38
|
+
## Rules
|
|
76
39
|
|
|
77
|
-
|
|
78
|
-
<View style={{ flexDirection: 'row', gap: 8 }}>
|
|
79
|
-
{/* Circle (varsayılan) */}
|
|
80
|
-
<Avatar
|
|
81
|
-
uri="https://example.com/avatar.jpg"
|
|
82
|
-
shape="circle"
|
|
83
|
-
size="lg"
|
|
84
|
-
/>
|
|
40
|
+
### Required
|
|
85
41
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/>
|
|
92
|
-
</View>
|
|
93
|
-
```
|
|
42
|
+
1. **ALWAYS** provide at least one: `uri`, `name`, or `icon`
|
|
43
|
+
2. **MUST** handle missing images gracefully
|
|
44
|
+
3. **NEVER** use broken or invalid image URLs
|
|
45
|
+
4. **ALWAYS** provide accessibility labels
|
|
46
|
+
5. **MUST** maintain appropriate size for context
|
|
94
47
|
|
|
95
|
-
|
|
48
|
+
### Content Priority
|
|
96
49
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
showStatus
|
|
102
|
-
status="online"
|
|
103
|
-
size="lg"
|
|
104
|
-
/>
|
|
50
|
+
1. **ALWAYS** prioritize: `uri` > `name` (initials) > `icon`
|
|
51
|
+
2. **MUST** fallback gracefully if image fails
|
|
52
|
+
3. **SHOULD** provide name for accessibility
|
|
53
|
+
4. **NEVER** show empty avatar
|
|
105
54
|
|
|
106
|
-
|
|
107
|
-
uri="https://example.com/avatar.jpg"
|
|
108
|
-
showStatus
|
|
109
|
-
status="offline"
|
|
110
|
-
size="lg"
|
|
111
|
-
/>
|
|
55
|
+
### Status Indicator
|
|
112
56
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
size="lg"
|
|
118
|
-
/>
|
|
57
|
+
1. **ALWAYS** set `showStatus` to enable status
|
|
58
|
+
2. **MUST** provide valid `status` value when shown
|
|
59
|
+
3. **SHOULD** reflect actual user status
|
|
60
|
+
4. **NEVER** show status without `showStatus` prop
|
|
119
61
|
|
|
120
|
-
|
|
121
|
-
uri="https://example.com/avatar.jpg"
|
|
122
|
-
showStatus
|
|
123
|
-
status="busy"
|
|
124
|
-
size="lg"
|
|
125
|
-
/>
|
|
126
|
-
</View>
|
|
127
|
-
```
|
|
62
|
+
## Forbidden
|
|
128
63
|
|
|
129
|
-
|
|
64
|
+
❌ **NEVER** do these:
|
|
130
65
|
|
|
131
66
|
```tsx
|
|
67
|
+
// ❌ Empty avatar
|
|
68
|
+
<Avatar /> {/* No content */}
|
|
69
|
+
|
|
70
|
+
// ❌ Invalid URI
|
|
71
|
+
<Avatar uri="not-a-valid-url" />
|
|
72
|
+
|
|
73
|
+
// ❌ Too many props
|
|
132
74
|
<Avatar
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
75
|
+
uri="image.jpg"
|
|
76
|
+
name="John"
|
|
77
|
+
icon="person" // ❌ URI takes priority
|
|
136
78
|
/>
|
|
137
|
-
```
|
|
138
79
|
|
|
139
|
-
|
|
80
|
+
// ❌ Status without showStatus
|
|
81
|
+
<Avatar
|
|
82
|
+
uri="image.jpg"
|
|
83
|
+
status="online" // ❌ Missing showStatus
|
|
84
|
+
/>
|
|
140
85
|
|
|
141
|
-
|
|
86
|
+
// ❌ Wrong size for context
|
|
142
87
|
<Avatar
|
|
143
|
-
uri="
|
|
144
|
-
size="
|
|
145
|
-
|
|
88
|
+
uri="image.jpg"
|
|
89
|
+
size="xl" // Too big for list item
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
// ❌ No accessibility
|
|
93
|
+
<Avatar uri="image.jpg" /> {/* Missing accessibilityLabel */}
|
|
94
|
+
|
|
95
|
+
// ❌ Hardcoded status
|
|
96
|
+
<Avatar
|
|
97
|
+
uri="image.jpg"
|
|
98
|
+
showStatus
|
|
99
|
+
status="online" // ❌ Should reflect actual status
|
|
146
100
|
/>
|
|
147
101
|
```
|
|
148
102
|
|
|
149
|
-
##
|
|
103
|
+
## Best Practices
|
|
150
104
|
|
|
151
|
-
###
|
|
105
|
+
### Size Selection
|
|
152
106
|
|
|
107
|
+
✅ **DO**:
|
|
153
108
|
```tsx
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<View style={{ padding: 16 }}>
|
|
157
|
-
{users.map((user) => (
|
|
158
|
-
<View key={user.id} style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 16 }}>
|
|
159
|
-
<Avatar
|
|
160
|
-
uri={user.avatar}
|
|
161
|
-
name={user.name}
|
|
162
|
-
showStatus
|
|
163
|
-
status={user.status}
|
|
164
|
-
size="md"
|
|
165
|
-
style={{ marginRight: 12 }}
|
|
166
|
-
/>
|
|
167
|
-
|
|
168
|
-
<View style={{ flex: 1 }}>
|
|
169
|
-
<AtomicText type="bodyLarge" fontWeight="600">
|
|
170
|
-
{user.name}
|
|
171
|
-
</AtomicText>
|
|
172
|
-
<AtomicText type="bodySmall" color="textSecondary">
|
|
173
|
-
@{user.username}
|
|
174
|
-
</AtomicText>
|
|
175
|
-
</View>
|
|
176
|
-
</View>
|
|
177
|
-
))}
|
|
178
|
-
</View>
|
|
179
|
-
);
|
|
180
|
-
};
|
|
181
|
-
```
|
|
109
|
+
// List items - small
|
|
110
|
+
<Avatar size="sm" />
|
|
182
111
|
|
|
183
|
-
|
|
112
|
+
// Standard display - medium
|
|
113
|
+
<Avatar size="md" />
|
|
184
114
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const visibleUsers = users.slice(0, max);
|
|
188
|
-
const remainingCount = users.length - max;
|
|
189
|
-
|
|
190
|
-
return (
|
|
191
|
-
<View style={{ flexDirection: 'row' }}>
|
|
192
|
-
{visibleUsers.map((user, index) => (
|
|
193
|
-
<Avatar
|
|
194
|
-
key={user.id}
|
|
195
|
-
uri={user.avatar}
|
|
196
|
-
name={user.name}
|
|
197
|
-
size="sm"
|
|
198
|
-
style={{
|
|
199
|
-
marginLeft: index > 0 ? -8 : 0,
|
|
200
|
-
borderWidth: 2,
|
|
201
|
-
borderColor: '#fff',
|
|
202
|
-
}}
|
|
203
|
-
/>
|
|
204
|
-
))}
|
|
205
|
-
|
|
206
|
-
{remainingCount > 0 && (
|
|
207
|
-
<View
|
|
208
|
-
style={{
|
|
209
|
-
width: 40,
|
|
210
|
-
height: 40,
|
|
211
|
-
borderRadius: 20,
|
|
212
|
-
backgroundColor: '#e0e0e0',
|
|
213
|
-
justifyContent: 'center',
|
|
214
|
-
alignItems: 'center',
|
|
215
|
-
marginLeft: -8,
|
|
216
|
-
borderWidth: 2,
|
|
217
|
-
borderColor: '#fff',
|
|
218
|
-
}}
|
|
219
|
-
>
|
|
220
|
-
<AtomicText type="labelSmall">
|
|
221
|
-
+{remainingCount}
|
|
222
|
-
</AtomicText>
|
|
223
|
-
</View>
|
|
224
|
-
)}
|
|
225
|
-
</View>
|
|
226
|
-
);
|
|
227
|
-
};
|
|
115
|
+
// Profile page - large
|
|
116
|
+
<Avatar size="xl" />
|
|
228
117
|
```
|
|
229
118
|
|
|
230
|
-
|
|
231
|
-
|
|
119
|
+
❌ **DON'T**:
|
|
232
120
|
```tsx
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
uri={user.avatar}
|
|
238
|
-
name={user.name}
|
|
239
|
-
size="xl"
|
|
240
|
-
showStatus
|
|
241
|
-
status={user.status}
|
|
242
|
-
style={{ marginBottom: 16 }}
|
|
243
|
-
/>
|
|
244
|
-
|
|
245
|
-
<AtomicText type="headlineSmall">
|
|
246
|
-
{user.name}
|
|
247
|
-
</AtomicText>
|
|
248
|
-
|
|
249
|
-
<AtomicText type="bodyMedium" color="textSecondary">
|
|
250
|
-
@{user.username}
|
|
251
|
-
</AtomicText>
|
|
252
|
-
</View>
|
|
253
|
-
);
|
|
254
|
-
};
|
|
121
|
+
// Don't use wrong size for context
|
|
122
|
+
<ListItem>
|
|
123
|
+
<Avatar size="xl" /> {/* ❌ Too big for list */}
|
|
124
|
+
</ListItem>
|
|
255
125
|
```
|
|
256
126
|
|
|
257
|
-
###
|
|
127
|
+
### Status Usage
|
|
258
128
|
|
|
129
|
+
✅ **DO**:
|
|
259
130
|
```tsx
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
<Pressable
|
|
267
|
-
style={{ flexDirection: 'row', alignItems: 'center', padding: 16 }}
|
|
268
|
-
onPress={() => navigation.navigate('Chat', { chatId: item.id })}
|
|
269
|
-
>
|
|
270
|
-
<Avatar
|
|
271
|
-
uri={item.avatar}
|
|
272
|
-
name={item.name}
|
|
273
|
-
showStatus
|
|
274
|
-
status={item.online ? 'online' : 'offline'}
|
|
275
|
-
size="md"
|
|
276
|
-
style={{ marginRight: 12 }}
|
|
277
|
-
/>
|
|
278
|
-
|
|
279
|
-
<View style={{ flex: 1 }}>
|
|
280
|
-
<AtomicText type="bodyLarge" fontWeight="600">
|
|
281
|
-
{item.name}
|
|
282
|
-
</AtomicText>
|
|
283
|
-
<AtomicText type="bodySmall" color="textSecondary" numberOfLines={1}>
|
|
284
|
-
{item.lastMessage}
|
|
285
|
-
</AtomicText>
|
|
286
|
-
</View>
|
|
287
|
-
|
|
288
|
-
<AtomicText type="bodySmall" color="textTertiary">
|
|
289
|
-
{item.time}
|
|
290
|
-
</AtomicText>
|
|
291
|
-
</Pressable>
|
|
292
|
-
)}
|
|
293
|
-
/>
|
|
294
|
-
);
|
|
295
|
-
};
|
|
131
|
+
// Show actual status
|
|
132
|
+
<Avatar
|
|
133
|
+
uri={user.avatar}
|
|
134
|
+
showStatus
|
|
135
|
+
status={user.isOnline ? 'online' : 'offline'}
|
|
136
|
+
/>
|
|
296
137
|
```
|
|
297
138
|
|
|
298
|
-
|
|
299
|
-
|
|
139
|
+
❌ **DON'T**:
|
|
300
140
|
```tsx
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
uri={member.avatar}
|
|
308
|
-
name={member.name}
|
|
309
|
-
showStatus
|
|
310
|
-
status={member.status}
|
|
311
|
-
size="sm"
|
|
312
|
-
/>
|
|
313
|
-
|
|
314
|
-
<AtomicText type="bodySmall" style={{ marginTop: 4 }}>
|
|
315
|
-
{member.firstName}
|
|
316
|
-
</AtomicText>
|
|
317
|
-
</View>
|
|
318
|
-
))}
|
|
319
|
-
</View>
|
|
320
|
-
);
|
|
321
|
-
};
|
|
141
|
+
// Don't fake status
|
|
142
|
+
<Avatar
|
|
143
|
+
uri="image.jpg"
|
|
144
|
+
showStatus
|
|
145
|
+
status="online" // ❌ Not real status
|
|
146
|
+
/>
|
|
322
147
|
```
|
|
323
148
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
### AvatarProps
|
|
149
|
+
### Fallback Hierarchy
|
|
327
150
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
| `backgroundColor` | `string` | - | Arka plan rengi |
|
|
336
|
-
| `showStatus` | `boolean` | `false` | Status göster |
|
|
337
|
-
| `status` | `StatusType` | `'offline'` | Durum |
|
|
338
|
-
| `style` | `ViewStyle` | - | Özel stil |
|
|
339
|
-
| `imageStyle` | `ImageStyle` | - | Resim stili |
|
|
340
|
-
| `onPress` | `() => void` | - | Tıklama olayı |
|
|
151
|
+
✅ **DO**:
|
|
152
|
+
```tsx
|
|
153
|
+
// 1. Image with name fallback
|
|
154
|
+
<Avatar
|
|
155
|
+
uri={avatarUri}
|
|
156
|
+
name="John Doe"
|
|
157
|
+
/>
|
|
341
158
|
|
|
342
|
-
|
|
159
|
+
// 2. Name only
|
|
160
|
+
<Avatar name="John Doe" /> {/* Shows "JD" */}
|
|
343
161
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
| 'xs' // Extra small
|
|
347
|
-
| 'sm' // Small
|
|
348
|
-
| 'md' // Medium (varsayılan)
|
|
349
|
-
| 'lg' // Large
|
|
350
|
-
| 'xl'; // Extra large
|
|
162
|
+
// 3. Icon fallback
|
|
163
|
+
<Avatar icon="person-outline" />
|
|
351
164
|
```
|
|
352
165
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
166
|
+
❌ **DON'T**:
|
|
167
|
+
```tsx
|
|
168
|
+
// Don't provide unnecessary props
|
|
169
|
+
<Avatar
|
|
170
|
+
uri="image.jpg"
|
|
171
|
+
name="John Doe"
|
|
172
|
+
icon="person" // ❌ Unnecessary
|
|
173
|
+
/>
|
|
357
174
|
```
|
|
358
175
|
|
|
359
|
-
|
|
176
|
+
## AI Coding Guidelines
|
|
177
|
+
|
|
178
|
+
### For AI Agents
|
|
179
|
+
|
|
180
|
+
When generating Avatar components, follow these rules:
|
|
181
|
+
|
|
182
|
+
1. **Always import from correct path**:
|
|
183
|
+
```typescript
|
|
184
|
+
import { Avatar } from 'react-native-design-system/src/molecules/avatar';
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
2. **Always provide content**:
|
|
188
|
+
```tsx
|
|
189
|
+
// ✅ Good - With fallback
|
|
190
|
+
<Avatar
|
|
191
|
+
uri={user.avatar}
|
|
192
|
+
name={user.name}
|
|
193
|
+
/>
|
|
194
|
+
|
|
195
|
+
// ❌ Bad - No fallback
|
|
196
|
+
<Avatar uri={user.avatar} />
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
3. **Always use appropriate size**:
|
|
200
|
+
```tsx
|
|
201
|
+
// List items
|
|
202
|
+
<Avatar size="sm" />
|
|
203
|
+
|
|
204
|
+
// Standard
|
|
205
|
+
<Avatar size="md" />
|
|
206
|
+
|
|
207
|
+
// Profile
|
|
208
|
+
<Avatar size="lg" />
|
|
209
|
+
|
|
210
|
+
// Featured
|
|
211
|
+
<Avatar size="xl" />
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
4. **Always handle status correctly**:
|
|
215
|
+
```tsx
|
|
216
|
+
// ❌ Bad
|
|
217
|
+
<Avatar
|
|
218
|
+
uri="image.jpg"
|
|
219
|
+
status="online" // Missing showStatus
|
|
220
|
+
/>
|
|
221
|
+
|
|
222
|
+
// ✅ Good
|
|
223
|
+
<Avatar
|
|
224
|
+
uri="image.jpg"
|
|
225
|
+
showStatus
|
|
226
|
+
status={user.isOnline ? 'online' : 'offline'}
|
|
227
|
+
/>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
5. **Never forget accessibility**:
|
|
231
|
+
```tsx
|
|
232
|
+
// ❌ Bad
|
|
233
|
+
<Avatar uri="image.jpg" />
|
|
234
|
+
|
|
235
|
+
// ✅ Good
|
|
236
|
+
<Avatar
|
|
237
|
+
uri="image.jpg}
|
|
238
|
+
name="John Doe"
|
|
239
|
+
accessibilityLabel="John Doe's profile picture"
|
|
240
|
+
/>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Common Patterns
|
|
244
|
+
|
|
245
|
+
#### User List Item
|
|
246
|
+
```tsx
|
|
247
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
248
|
+
<Avatar
|
|
249
|
+
uri={user.avatar}
|
|
250
|
+
name={user.name}
|
|
251
|
+
size="md"
|
|
252
|
+
showStatus
|
|
253
|
+
status={user.isOnline ? 'online' : 'offline'}
|
|
254
|
+
style={{ marginRight: 12 }}
|
|
255
|
+
/>
|
|
360
256
|
|
|
361
|
-
|
|
362
|
-
type
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
| 'busy'; // Kırmızı
|
|
257
|
+
<View>
|
|
258
|
+
<Text type="bodyLarge">{user.name}</Text>
|
|
259
|
+
<Text type="bodySmall" color="secondary">@{user.username}</Text>
|
|
260
|
+
</View>
|
|
261
|
+
</View>
|
|
367
262
|
```
|
|
368
263
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
### 1. Boyut Seçimi
|
|
372
|
-
|
|
264
|
+
#### Profile Header
|
|
373
265
|
```tsx
|
|
374
|
-
|
|
375
|
-
<Avatar
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
266
|
+
<View style={{ alignItems: 'center', padding: 24 }}>
|
|
267
|
+
<Avatar
|
|
268
|
+
uri={user.avatar}
|
|
269
|
+
name={user.name}
|
|
270
|
+
size="xl"
|
|
271
|
+
showStatus
|
|
272
|
+
status={user.status}
|
|
273
|
+
style={{ marginBottom: 16 }}
|
|
274
|
+
/>
|
|
379
275
|
|
|
380
|
-
|
|
381
|
-
<
|
|
276
|
+
<Text type="headlineSmall">{user.name}</Text>
|
|
277
|
+
<Text type="bodyMedium" color="secondary">@{user.username}</Text>
|
|
278
|
+
</View>
|
|
382
279
|
```
|
|
383
280
|
|
|
384
|
-
|
|
385
|
-
|
|
281
|
+
#### Avatar Group
|
|
386
282
|
```tsx
|
|
387
|
-
|
|
388
|
-
|
|
283
|
+
<View style={{ flexDirection: 'row' }}>
|
|
284
|
+
{users.slice(0, 3).map((user, index) => (
|
|
285
|
+
<Avatar
|
|
286
|
+
key={user.id}
|
|
287
|
+
uri={user.avatar}
|
|
288
|
+
name={user.name}
|
|
289
|
+
size="sm"
|
|
290
|
+
style={{ marginLeft: index > 0 ? -8 : 0 }}
|
|
291
|
+
/>
|
|
292
|
+
))}
|
|
389
293
|
|
|
390
|
-
|
|
391
|
-
<
|
|
294
|
+
{users.length > 3 && (
|
|
295
|
+
<View style={{ marginLeft: -8 }}>
|
|
296
|
+
<Avatar name={`+${users.length - 3}`} size="sm" />
|
|
297
|
+
</View>
|
|
298
|
+
)}
|
|
299
|
+
</View>
|
|
392
300
|
```
|
|
393
301
|
|
|
394
|
-
|
|
395
|
-
|
|
302
|
+
#### Pressable Avatar
|
|
396
303
|
```tsx
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
// 3. Hiçbiri yoksa
|
|
404
|
-
<Avatar /> {/* İkon */}
|
|
304
|
+
<Avatar
|
|
305
|
+
uri={user.avatar}
|
|
306
|
+
name={user.name}
|
|
307
|
+
size="lg"
|
|
308
|
+
onPress={() => navigation.navigate('Profile', { userId: user.id })}
|
|
309
|
+
/>
|
|
405
310
|
```
|
|
406
311
|
|
|
407
|
-
##
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
-
|
|
412
|
-
-
|
|
413
|
-
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
312
|
+
## Props Reference
|
|
313
|
+
|
|
314
|
+
| Prop | Type | Required | Default | Description |
|
|
315
|
+
|------|------|----------|---------|-------------|
|
|
316
|
+
| `uri` | `string` | No | - | Image URI |
|
|
317
|
+
| `name` | `string` | No | - | User name (for initials) |
|
|
318
|
+
| `icon` | `string` | No | - | Fallback icon name |
|
|
319
|
+
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | No | `'md'` | Avatar size |
|
|
320
|
+
| `shape` | `'circle' \| 'square'` | No | `'circle'` | Avatar shape |
|
|
321
|
+
| `backgroundColor` | `string` | No | - | Custom background color |
|
|
322
|
+
| `showStatus` | `boolean` | No | `false` | Show status indicator |
|
|
323
|
+
| `status` | `'online' \| 'offline' \| 'away' \| 'busy'` | No | `'offline'` | Status type |
|
|
324
|
+
| `onPress` | `() => void` | No | - | Press handler |
|
|
325
|
+
| `accessibilityLabel` | `string` | No | - | Accessibility label |
|
|
326
|
+
|
|
327
|
+
### Size Values
|
|
328
|
+
|
|
329
|
+
| Size | Dimensions | Use Case |
|
|
330
|
+
|------|------------|----------|
|
|
331
|
+
| `xs` | 24x24pt | Compact lists |
|
|
332
|
+
| `sm` | 32x32pt | Standard lists |
|
|
333
|
+
| `md` | 40x40pt | Default size |
|
|
334
|
+
| `lg` | 56x56pt | Featured items |
|
|
335
|
+
| `xl` | 80x80pt | Profile pages |
|
|
336
|
+
|
|
337
|
+
### Status Types
|
|
338
|
+
|
|
339
|
+
| Status | Color | Meaning |
|
|
340
|
+
|--------|-------|---------|
|
|
341
|
+
| `online` | Green | Available |
|
|
342
|
+
| `offline` | Gray | Offline |
|
|
343
|
+
| `away` | Yellow | Away |
|
|
344
|
+
| `busy` | Red | Busy |
|
|
345
|
+
|
|
346
|
+
## Accessibility
|
|
347
|
+
|
|
348
|
+
- ✅ Screen reader announces user name
|
|
349
|
+
- ✅ FaceID support for status
|
|
350
|
+
- ✅ Touch target: minimum 44x44pt
|
|
351
|
+
- ✅ Accessibility label support
|
|
352
|
+
- ✅ Test ID support for testing
|
|
353
|
+
|
|
354
|
+
## Performance
|
|
355
|
+
|
|
356
|
+
1. **Image caching**: Enable image caching
|
|
357
|
+
2. **Lazy loading**: Use in long lists
|
|
358
|
+
3. **Optimization**: Resize images appropriately
|
|
359
|
+
4. **Memoization**: Memo avatar components in lists
|
|
360
|
+
|
|
361
|
+
## Related Components
|
|
362
|
+
|
|
363
|
+
- [`AvatarGroup`](./AvatarGroup/README.md) - Avatar group component
|
|
364
|
+
- [`AtomicAvatar`](../../atoms/AtomicAvatar/README.md) - Atom avatar component
|
|
365
|
+
- [`AtomicIcon`](../../atoms/AtomicIcon/README.md) - Icon component
|
|
366
|
+
- [`MediaCard`](../media-card/README.md) - Media card component
|
|
367
|
+
|
|
368
|
+
## License
|
|
430
369
|
|
|
431
370
|
MIT
|