@umituz/react-native-design-system 2.6.85 → 2.6.87
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 -3
- package/src/atoms/AtomicAvatar.README.md +483 -0
- package/src/atoms/AtomicBadge.README.md +423 -0
- package/src/atoms/AtomicCard.README.md +337 -0
- package/src/atoms/AtomicDatePicker.README.md +399 -0
- package/src/atoms/AtomicFab.README.md +421 -0
- package/src/atoms/AtomicIcon.README.md +349 -0
- package/src/atoms/AtomicSpinner.README.md +433 -0
- package/src/atoms/AtomicText.README.md +470 -0
- package/src/atoms/AtomicTextArea.README.md +352 -0
- package/src/atoms/GlassView/GlassView.tsx +28 -17
- package/src/atoms/GlassView/README.md +521 -0
- package/src/atoms/button/README.md +363 -0
- package/src/atoms/chip/README.md +376 -0
- package/src/atoms/input/README.md +342 -0
- package/src/atoms/picker/README.md +412 -0
- package/src/molecules/BaseModal.README.md +435 -0
- package/src/molecules/FormField.README.md +486 -0
- package/src/molecules/GlowingCard/README.md +448 -0
- package/src/molecules/ListItem.README.md +402 -0
- package/src/molecules/SearchBar/README.md +533 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# BaseModal
|
|
2
|
+
|
|
3
|
+
BaseModal, React Native için genel amaçlı bir modal bileşenidir. Responsive tasarım ile çalışır ve tüm modal türleri için tutarlı bir taban sağlar.
|
|
4
|
+
|
|
5
|
+
## Özellikler
|
|
6
|
+
|
|
7
|
+
- 📱 **Responsive**: Cihaz boyutuna göre uyum
|
|
8
|
+
- 🎨 **Tema Bilinci**: Tam tema entegrasyonu
|
|
9
|
+
- ⬛ **Backdrop**: Opak arka plan
|
|
10
|
+
- ❌ **Dismiss**: Backdrop tıklama ile kapatma
|
|
11
|
+
- ♿ **Erişilebilir**: Tam erişilebilirlik desteği
|
|
12
|
+
- 🔄 **Fade Animation**: Yumuşak animasyon
|
|
13
|
+
|
|
14
|
+
## Kurulum
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { BaseModal } from 'react-native-design-system';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Temel Kullanım
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import React, { useState } from 'react';
|
|
24
|
+
import { View, Text, Button } from 'react-native';
|
|
25
|
+
import { BaseModal } from 'react-native-design-system';
|
|
26
|
+
|
|
27
|
+
export const BasicExample = () => {
|
|
28
|
+
const [visible, setVisible] = useState(false);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View style={{ padding: 16 }}>
|
|
32
|
+
<Button title="Modalı Aç" onPress={() => setVisible(true)} />
|
|
33
|
+
|
|
34
|
+
<BaseModal
|
|
35
|
+
visible={visible}
|
|
36
|
+
onClose={() => setVisible(false)}
|
|
37
|
+
>
|
|
38
|
+
<View style={{ padding: 24 }}>
|
|
39
|
+
<Text>Modal İçeriği</Text>
|
|
40
|
+
</View>
|
|
41
|
+
</BaseModal>
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Basic Modal
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
const [visible, setVisible] = useState(false);
|
|
51
|
+
|
|
52
|
+
<BaseModal
|
|
53
|
+
visible={visible}
|
|
54
|
+
onClose={() => setVisible(false)}
|
|
55
|
+
>
|
|
56
|
+
<View style={{ padding: 24 }}>
|
|
57
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold' }}>
|
|
58
|
+
Başlık
|
|
59
|
+
</Text>
|
|
60
|
+
<Text style={{ marginTop: 16 }}>
|
|
61
|
+
Modal içeriği buraya gelecek.
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
</BaseModal>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Disable Backdrop Dismiss
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<BaseModal
|
|
71
|
+
visible={visible}
|
|
72
|
+
onClose={() => setVisible(false)}
|
|
73
|
+
dismissOnBackdrop={false}
|
|
74
|
+
>
|
|
75
|
+
{/* Kullanıcı kapama butonuna basmalı */}
|
|
76
|
+
</BaseModal>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Custom Content Style
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<BaseModal
|
|
83
|
+
visible={visible}
|
|
84
|
+
onClose={() => setVisible(false)}
|
|
85
|
+
contentStyle={{
|
|
86
|
+
backgroundColor: '#f5f5f5',
|
|
87
|
+
padding: 32,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<Text>Özel Stil</Text>
|
|
91
|
+
</BaseModal>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Örnek Kullanımlar
|
|
95
|
+
|
|
96
|
+
### Onay Modalı
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
export const ConfirmationModal = ({ visible, onClose, onConfirm }) => {
|
|
100
|
+
return (
|
|
101
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
102
|
+
<View style={{ padding: 24, alignItems: 'center' }}>
|
|
103
|
+
<AtomicIcon
|
|
104
|
+
name="warning"
|
|
105
|
+
size="xl"
|
|
106
|
+
color="warning"
|
|
107
|
+
style={{ marginBottom: 16 }}
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 8 }}>
|
|
111
|
+
Emin misiniz?
|
|
112
|
+
</Text>
|
|
113
|
+
|
|
114
|
+
<Text style={{ textAlign: 'center', color: 'gray', marginBottom: 24 }}>
|
|
115
|
+
Bu işlem geri alınamaz. Devam etmek istediğinizden emin misiniz?
|
|
116
|
+
</Text>
|
|
117
|
+
|
|
118
|
+
<View style={{ flexDirection: 'row', gap: 12 }}>
|
|
119
|
+
<Button title="İptal" onPress={onClose} />
|
|
120
|
+
<Button title="Evet, Eminim" onPress={onConfirm} />
|
|
121
|
+
</View>
|
|
122
|
+
</View>
|
|
123
|
+
</BaseModal>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Form Modalı
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
export const FormModal = ({ visible, onClose }) => {
|
|
132
|
+
const [formData, setFormData] = useState({
|
|
133
|
+
name: '',
|
|
134
|
+
email: '',
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const handleSubmit = () => {
|
|
138
|
+
console.log(formData);
|
|
139
|
+
onClose();
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
144
|
+
<View style={{ padding: 24 }}>
|
|
145
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 24 }}>
|
|
146
|
+
Yeni Kullanıcı
|
|
147
|
+
</Text>
|
|
148
|
+
|
|
149
|
+
<FormField
|
|
150
|
+
label="Ad Soyad"
|
|
151
|
+
value={formData.name}
|
|
152
|
+
onChangeText={(text) => setFormData({ ...formData, name: text })}
|
|
153
|
+
placeholder="Adınız ve soyadınız"
|
|
154
|
+
style={{ marginBottom: 16 }}
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
<FormField
|
|
158
|
+
label="E-posta"
|
|
159
|
+
value={formData.email}
|
|
160
|
+
onChangeText={(text) => setFormData({ ...formData, email: text })}
|
|
161
|
+
placeholder="ornek@email.com"
|
|
162
|
+
keyboardType="email-address"
|
|
163
|
+
style={{ marginBottom: 24 }}
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<Button title="Kaydet" onPress={handleSubmit} />
|
|
167
|
+
</View>
|
|
168
|
+
</BaseModal>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Bilgi Modalı
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
export const InfoModal = ({ visible, onClose, title, message }) => {
|
|
177
|
+
return (
|
|
178
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
179
|
+
<View style={{ padding: 24, alignItems: 'center' }}>
|
|
180
|
+
<AtomicIcon
|
|
181
|
+
name="information-circle"
|
|
182
|
+
size="xl"
|
|
183
|
+
color="info"
|
|
184
|
+
style={{ marginBottom: 16 }}
|
|
185
|
+
/>
|
|
186
|
+
|
|
187
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 8 }}>
|
|
188
|
+
{title}
|
|
189
|
+
</Text>
|
|
190
|
+
|
|
191
|
+
<Text style={{ textAlign: 'center', color: 'gray', marginBottom: 24 }}>
|
|
192
|
+
{message}
|
|
193
|
+
</Text>
|
|
194
|
+
|
|
195
|
+
<Button title="Tamam" onPress={onClose} />
|
|
196
|
+
</View>
|
|
197
|
+
</BaseModal>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Başarı Modalı
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
export const SuccessModal = ({ visible, onClose, message }) => {
|
|
206
|
+
return (
|
|
207
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
208
|
+
<View style={{ padding: 24, alignItems: 'center' }}>
|
|
209
|
+
<View
|
|
210
|
+
style={{
|
|
211
|
+
width: 80,
|
|
212
|
+
height: 80,
|
|
213
|
+
borderRadius: 40,
|
|
214
|
+
backgroundColor: '#d4edda',
|
|
215
|
+
justifyContent: 'center',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
marginBottom: 16,
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
<AtomicIcon name="checkmark" size="xl" color="success" />
|
|
221
|
+
</View>
|
|
222
|
+
|
|
223
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 8 }}>
|
|
224
|
+
Başarılı!
|
|
225
|
+
</Text>
|
|
226
|
+
|
|
227
|
+
<Text style={{ textAlign: 'center', color: 'gray', marginBottom: 24 }}>
|
|
228
|
+
{message}
|
|
229
|
+
</Text>
|
|
230
|
+
|
|
231
|
+
<Button title="Tamam" onPress={onClose} />
|
|
232
|
+
</View>
|
|
233
|
+
</BaseModal>
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Hata Modalı
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
export const ErrorModal = ({ visible, onClose, error }) => {
|
|
242
|
+
return (
|
|
243
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
244
|
+
<View style={{ padding: 24, alignItems: 'center' }}>
|
|
245
|
+
<AtomicIcon
|
|
246
|
+
name="close-circle"
|
|
247
|
+
size="xl"
|
|
248
|
+
color="error"
|
|
249
|
+
style={{ marginBottom: 16 }}
|
|
250
|
+
/>
|
|
251
|
+
|
|
252
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold', marginBottom: 8 }}>
|
|
253
|
+
Hata Oluştu
|
|
254
|
+
</Text>
|
|
255
|
+
|
|
256
|
+
<Text style={{ textAlign: 'center', color: 'gray', marginBottom: 24 }}>
|
|
257
|
+
{error}
|
|
258
|
+
</Text>
|
|
259
|
+
|
|
260
|
+
<Button title="Tamam" onPress={onClose} />
|
|
261
|
+
</View>
|
|
262
|
+
</BaseModal>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Resim Önizleme Modalı
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
export const ImagePreviewModal = ({ visible, onClose, imageUri }) => {
|
|
271
|
+
return (
|
|
272
|
+
<BaseModal
|
|
273
|
+
visible={visible}
|
|
274
|
+
onClose={onClose}
|
|
275
|
+
contentStyle={{
|
|
276
|
+
backgroundColor: 'transparent',
|
|
277
|
+
borderWidth: 0,
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
<Pressable onPress={onClose} style={{ flex: 1 }}>
|
|
281
|
+
<Image
|
|
282
|
+
source={{ uri: imageUri }}
|
|
283
|
+
style={{ width: '100%', height: '100%' }}
|
|
284
|
+
resizeMode="contain"
|
|
285
|
+
/>
|
|
286
|
+
</Pressable>
|
|
287
|
+
</BaseModal>
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Detay Modalı
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
export const DetailModal = ({ visible, onClose, item }) => {
|
|
296
|
+
if (!item) return null;
|
|
297
|
+
|
|
298
|
+
return (
|
|
299
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
300
|
+
<View style={{ padding: 24 }}>
|
|
301
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
302
|
+
<Text style={{ fontSize: 20, fontWeight: 'bold' }}>
|
|
303
|
+
{item.title}
|
|
304
|
+
</Text>
|
|
305
|
+
<Pressable onPress={onClose}>
|
|
306
|
+
<AtomicIcon name="close" size="md" />
|
|
307
|
+
</Pressable>
|
|
308
|
+
</View>
|
|
309
|
+
|
|
310
|
+
<View style={{ marginTop: 16 }}>
|
|
311
|
+
<Text style={{ color: 'gray', marginBottom: 8 }}>
|
|
312
|
+
Açıklama
|
|
313
|
+
</Text>
|
|
314
|
+
<Text>{item.description}</Text>
|
|
315
|
+
</View>
|
|
316
|
+
|
|
317
|
+
<View style={{ marginTop: 16 }}>
|
|
318
|
+
<Text style={{ color: 'gray', marginBottom: 8 }}>
|
|
319
|
+
Detaylar
|
|
320
|
+
</Text>
|
|
321
|
+
{item.details.map((detail, index) => (
|
|
322
|
+
<View key={index} style={{ flexDirection: 'row', marginBottom: 8 }}>
|
|
323
|
+
<Text style={{ fontWeight: '600', width: 120 }}>
|
|
324
|
+
{detail.label}:
|
|
325
|
+
</Text>
|
|
326
|
+
<Text style={{ flex: 1 }}>{detail.value}</Text>
|
|
327
|
+
</View>
|
|
328
|
+
))}
|
|
329
|
+
</View>
|
|
330
|
+
|
|
331
|
+
<View style={{ marginTop: 24 }}>
|
|
332
|
+
<Button title="Kapat" onPress={onClose} />
|
|
333
|
+
</View>
|
|
334
|
+
</View>
|
|
335
|
+
</BaseModal>
|
|
336
|
+
);
|
|
337
|
+
};
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Props
|
|
341
|
+
|
|
342
|
+
### BaseModalProps
|
|
343
|
+
|
|
344
|
+
| Prop | Tip | Varsayılan | Açıklama |
|
|
345
|
+
|------|-----|------------|----------|
|
|
346
|
+
| `visible` | `boolean` | - **(Zorunlu)** | Modal görünürlüğü |
|
|
347
|
+
| `onClose` | `() => void` | - **(Zorunlu)** | Kapatma callback'i |
|
|
348
|
+
| `children` | `ReactNode` | - **(Zorunlu)** | Modal içeriği |
|
|
349
|
+
| `dismissOnBackdrop` | `boolean` | `true` | Backdrop tıklama ile kapatma |
|
|
350
|
+
| `contentStyle` | `ViewStyle` | - | İçerik stili |
|
|
351
|
+
| `testID` | `string` | `'base-modal'` | Test ID'si |
|
|
352
|
+
|
|
353
|
+
## Best Practices
|
|
354
|
+
|
|
355
|
+
### 1. Kapatma Kontrolü
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
// Önemli işlemler için backdrop dismiss'i kapatın
|
|
359
|
+
<BaseModal
|
|
360
|
+
visible={visible}
|
|
361
|
+
onClose={onClose}
|
|
362
|
+
dismissOnBackdrop={false}
|
|
363
|
+
>
|
|
364
|
+
<Text>İşlemi tamamlamalısınız</Text>
|
|
365
|
+
<Button title="Tamam" onPress={onComplete} />
|
|
366
|
+
</BaseModal>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### 2. State Yönetimi
|
|
370
|
+
|
|
371
|
+
```tsx
|
|
372
|
+
// Modal state'ini parent'ta tutun
|
|
373
|
+
const [modalState, setModalState] = useState({
|
|
374
|
+
visible: false,
|
|
375
|
+
data: null,
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
const openModal = (data) => {
|
|
379
|
+
setModalState({ visible: true, data });
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const closeModal = () => {
|
|
383
|
+
setModalState({ visible: false, data: null });
|
|
384
|
+
};
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### 3. İçerik Scroll
|
|
388
|
+
|
|
389
|
+
```tsx
|
|
390
|
+
// Uzun içerik için ScrollView kullanın
|
|
391
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
392
|
+
<ScrollView style={{ padding: 24 }}>
|
|
393
|
+
{/* Uzun içerik */}
|
|
394
|
+
</ScrollView>
|
|
395
|
+
</BaseModal>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### 4. Klavye Desteği
|
|
399
|
+
|
|
400
|
+
```tsx
|
|
401
|
+
// Input'larda klavye sorunlarını önleyin
|
|
402
|
+
<BaseModal visible={visible} onClose={onClose}>
|
|
403
|
+
<KeyboardAvoidingView behavior="padding" style={{ flex: 1 }}>
|
|
404
|
+
<View style={{ padding: 24 }}>
|
|
405
|
+
<FormField label="Ad" />
|
|
406
|
+
<FormField label="E-posta" />
|
|
407
|
+
</View>
|
|
408
|
+
</KeyboardAvoidingView>
|
|
409
|
+
</BaseModal>
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
## Erişilebilirlik
|
|
413
|
+
|
|
414
|
+
BaseModal, tam erişilebilirlik desteği sunar:
|
|
415
|
+
|
|
416
|
+
- ✅ Screen reader desteği
|
|
417
|
+
- ✅ Focus trap
|
|
418
|
+
- ✅ Escape key desteği (web)
|
|
419
|
+
- ✅ Test ID desteği
|
|
420
|
+
|
|
421
|
+
## Performans İpuçları
|
|
422
|
+
|
|
423
|
+
1. **Conditional Rendering**: Modal görünür değilse render etmeyin
|
|
424
|
+
2. **Memoization**: İçerik component'lerini memo edin
|
|
425
|
+
3. **Lazy Loading**: Ağır içerikleri lazy load edin
|
|
426
|
+
|
|
427
|
+
## İlgili Bileşenler
|
|
428
|
+
|
|
429
|
+
- [`ConfirmationModal`](./confirmation-modal/README.md) - Onay modalı
|
|
430
|
+
- [`BottomSheet`](./bottom-sheet/README.md) - Alt sheet modal
|
|
431
|
+
- [`FormField`](./FormField/README.md) - Form alanı
|
|
432
|
+
|
|
433
|
+
## Lisans
|
|
434
|
+
|
|
435
|
+
MIT
|