@umituz/react-native-design-system 2.6.87 → 2.6.88
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 -6
- package/src/atoms/AtomicProgress.README.md +402 -0
- package/src/atoms/EmptyState.README.md +372 -0
- package/src/atoms/skeleton/AtomicSkeleton.README.md +339 -0
- package/src/molecules/ConfirmationModal.README.md +370 -0
- package/src/molecules/Divider/README.md +470 -0
- package/src/molecules/StepHeader/README.md +487 -0
- package/src/molecules/alerts/README.md +471 -0
- package/src/molecules/avatar/README.md +431 -0
- package/src/molecules/bottom-sheet/README.md +413 -0
- package/src/molecules/calendar/README.md +339 -0
- package/src/molecules/countdown/README.md +558 -0
- package/src/molecules/media-card/README.md +384 -0
- package/src/molecules/navigation/README.md +377 -0
- package/src/molecules/splash/README.md +474 -0
- package/src/molecules/splash/components/SplashScreen.tsx +0 -14
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
# SplashScreen
|
|
2
|
+
|
|
3
|
+
SplashScreen, uygulama başlatılırken gösterilen açılış ekranı bileşenidir. Logo, uygulama adı, slogan ve yükleme göstergesi içerir. Theme-aware renk desteği ve zaman aşımı kontrolü sunar.
|
|
4
|
+
|
|
5
|
+
## Özellikler
|
|
6
|
+
|
|
7
|
+
- 🎨 **Theme-Aware**: Tema bilinci renkler
|
|
8
|
+
- 🌈 **Gradient Desteği**: Arka plan gradient'i
|
|
9
|
+
- ⏱️ **Timeout Kontrolü**: Maksimum süre ve timeout callback
|
|
10
|
+
- 🖼️ **Logo/İkon**: Uygulama logosu gösterimi
|
|
11
|
+
- 📝 **App Name & Tagline**: Uygulama adı ve sloganı
|
|
12
|
+
- ⏳ **Loading Indicator**: Otomatik yükleme göstergesi
|
|
13
|
+
- 🎭 **Özelleştirilebilir**: Renkler, stil, süre
|
|
14
|
+
- ♿ **Erişilebilir**: Screen reader desteği
|
|
15
|
+
|
|
16
|
+
## Kurulum
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { SplashScreen, useSplashFlow } from 'react-native-design-system';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Temel Kullanım
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import React, { useState } from 'react';
|
|
26
|
+
import { View } from 'react-native';
|
|
27
|
+
import { SplashScreen, useSplashFlow } from 'react-native-design-system';
|
|
28
|
+
|
|
29
|
+
export const App = () => {
|
|
30
|
+
const [isReady, setIsReady] = useState(false);
|
|
31
|
+
const { isInitialized } = useSplashFlow({ duration: 2000 });
|
|
32
|
+
|
|
33
|
+
if (!isInitialized) {
|
|
34
|
+
return (
|
|
35
|
+
<SplashScreen
|
|
36
|
+
appName="Uygulamam"
|
|
37
|
+
tagline="Hoş geldiniz"
|
|
38
|
+
visible={!isReady}
|
|
39
|
+
onReady={() => setIsReady(true)}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return <MainApp />;
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Basit Splash
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<SplashScreen
|
|
52
|
+
appName="My App"
|
|
53
|
+
tagline="Harika bir uygulama"
|
|
54
|
+
visible={true}
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Logo ile
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<SplashScreen
|
|
62
|
+
icon={require('../assets/logo.png')}
|
|
63
|
+
appName="My App"
|
|
64
|
+
tagline="Hoş geldiniz"
|
|
65
|
+
visible={true}
|
|
66
|
+
/>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Custom Renkler
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<SplashScreen
|
|
73
|
+
appName="My App"
|
|
74
|
+
tagline="Welcome"
|
|
75
|
+
colors={{
|
|
76
|
+
background: '#1a1a1a',
|
|
77
|
+
text: '#ffffff',
|
|
78
|
+
iconPlaceholder: '#ffffff30',
|
|
79
|
+
}}
|
|
80
|
+
visible={true}
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Gradient Arka Plan
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
<SplashScreen
|
|
88
|
+
appName="My App"
|
|
89
|
+
tagline="Welcome"
|
|
90
|
+
gradientColors={['#667eea', '#764ba2']}
|
|
91
|
+
visible={true}
|
|
92
|
+
/>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Zaman Aşımı
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<SplashScreen
|
|
99
|
+
appName="My App"
|
|
100
|
+
tagline="Yükleniyor..."
|
|
101
|
+
maxDuration={5000}
|
|
102
|
+
onTimeout={() => {
|
|
103
|
+
console.log('Splash timeout - showing error');
|
|
104
|
+
// Handle timeout
|
|
105
|
+
}}
|
|
106
|
+
visible={true}
|
|
107
|
+
/>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## useSplashFlow Hook
|
|
111
|
+
|
|
112
|
+
### Temel Kullanım
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { useSplashFlow } from 'react-native-design-system';
|
|
116
|
+
|
|
117
|
+
export const App = () => {
|
|
118
|
+
const { isInitialized } = useSplashFlow({ duration: 2000 });
|
|
119
|
+
|
|
120
|
+
if (!isInitialized) {
|
|
121
|
+
return <SplashScreen appName="My App" visible />;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return <MainApp />;
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Custom Süre
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
const { isInitialized } = useSplashFlow({
|
|
132
|
+
duration: 3000, // 3 saniye
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### DeviceEventEmitter Dinleme
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { DeviceEventEmitter } from 'react-native';
|
|
140
|
+
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const subscription = DeviceEventEmitter.addListener(
|
|
143
|
+
'splash-ready',
|
|
144
|
+
() => {
|
|
145
|
+
console.log('Splash is ready!');
|
|
146
|
+
navigation.replace('Main');
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
return () => subscription.remove();
|
|
151
|
+
}, []);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Örnek Kullanımlar
|
|
155
|
+
|
|
156
|
+
### Temel App Boot
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
export const App = () => {
|
|
160
|
+
const [appIsReady, setAppIsReady] = useState(false);
|
|
161
|
+
const { isInitialized } = useSplashFlow({ duration: 1500 });
|
|
162
|
+
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
async function prepare() {
|
|
165
|
+
try {
|
|
166
|
+
// Preload assets
|
|
167
|
+
await SplashScreen.preventAutoHideAsync();
|
|
168
|
+
// Load fonts, images, etc.
|
|
169
|
+
await loadAssetsAsync();
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.warn(e);
|
|
172
|
+
} finally {
|
|
173
|
+
setAppIsReady(true);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
prepare();
|
|
178
|
+
}, []);
|
|
179
|
+
|
|
180
|
+
if (!appIsReady || !isInitialized) {
|
|
181
|
+
return (
|
|
182
|
+
<SplashScreen
|
|
183
|
+
icon={require('./assets/logo.png')}
|
|
184
|
+
appName="My App"
|
|
185
|
+
tagline="Yükleniyor..."
|
|
186
|
+
visible
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return <Navigation />;
|
|
192
|
+
};
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Auth Flow ile
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
export const App = () => {
|
|
199
|
+
const [isReady, setIsReady] = useState(false);
|
|
200
|
+
const [user, setUser] = useState(null);
|
|
201
|
+
const { isInitialized } = useSplashFlow();
|
|
202
|
+
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
// Check auth state
|
|
205
|
+
checkAuthState().then((userData) => {
|
|
206
|
+
setUser(userData);
|
|
207
|
+
setIsReady(true);
|
|
208
|
+
});
|
|
209
|
+
}, []);
|
|
210
|
+
|
|
211
|
+
if (!isInitialized || !isReady) {
|
|
212
|
+
return (
|
|
213
|
+
<SplashScreen
|
|
214
|
+
appName="My App"
|
|
215
|
+
tagline="Giriş yapılıyor..."
|
|
216
|
+
gradientColors={['#667eea', '#764ba2']}
|
|
217
|
+
visible
|
|
218
|
+
/>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return user ? <AuthenticatedApp /> : <AuthStack />;
|
|
223
|
+
};
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Remote Config ile
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
export const App = () => {
|
|
230
|
+
const [config, setConfig] = useState(null);
|
|
231
|
+
const { isInitialized } = useSplashFlow({ duration: 2000 });
|
|
232
|
+
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
// Fetch remote config
|
|
235
|
+
fetchRemoteConfig().then((remoteConfig) => {
|
|
236
|
+
setConfig(remoteConfig);
|
|
237
|
+
});
|
|
238
|
+
}, []);
|
|
239
|
+
|
|
240
|
+
if (!isInitialized || !config) {
|
|
241
|
+
return (
|
|
242
|
+
<SplashScreen
|
|
243
|
+
icon={require('./assets/logo.png')}
|
|
244
|
+
appName="My App"
|
|
245
|
+
tagline="Ayarlar yükleniyor..."
|
|
246
|
+
maxDuration={5000}
|
|
247
|
+
onTimeout={() => {
|
|
248
|
+
// Fallback to default config
|
|
249
|
+
setConfig(getDefaultConfig());
|
|
250
|
+
}}
|
|
251
|
+
visible
|
|
252
|
+
/>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return <MainApp config={config} />;
|
|
257
|
+
};
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Animasyonlu Splash
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
export const AnimatedSplash = () => {
|
|
264
|
+
const [fadeAnim] = useState(new Animated.Value(0));
|
|
265
|
+
const { isInitialized } = useSplashFlow({ duration: 2000 });
|
|
266
|
+
|
|
267
|
+
useEffect(() => {
|
|
268
|
+
if (isInitialized) {
|
|
269
|
+
Animated.timing(fadeAnim, {
|
|
270
|
+
toValue: 1,
|
|
271
|
+
duration: 500,
|
|
272
|
+
useNativeDriver: true,
|
|
273
|
+
}).start(() => {
|
|
274
|
+
// Hide splash after animation
|
|
275
|
+
setTimeout(() => {
|
|
276
|
+
navigation.replace('Home');
|
|
277
|
+
}, 1000);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}, [isInitialized]);
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<SplashScreen
|
|
284
|
+
appName="My App"
|
|
285
|
+
tagline="Welcome"
|
|
286
|
+
gradientColors={['#667eea', '#764ba2']}
|
|
287
|
+
visible={!isInitialized}
|
|
288
|
+
/>
|
|
289
|
+
);
|
|
290
|
+
};
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Multi-Stage Loading
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
export const MultiStageSplash = () => {
|
|
297
|
+
const [loadingStage, setLoadingStage] = useState({
|
|
298
|
+
assets: false,
|
|
299
|
+
auth: false,
|
|
300
|
+
config: false,
|
|
301
|
+
});
|
|
302
|
+
const { isInitialized } = useSplashFlow({ duration: 1500 });
|
|
303
|
+
|
|
304
|
+
const allReady = Object.values(loadingStage).every(Boolean);
|
|
305
|
+
|
|
306
|
+
const getTagline = () => {
|
|
307
|
+
if (!loadingStage.assets) return 'Varlıklar yükleniyor...';
|
|
308
|
+
if (!loadingStage.auth) return 'Giriş yapılıyor...';
|
|
309
|
+
if (!loadingStage.config) return 'Ayarlar alınıyor...';
|
|
310
|
+
return 'Hazır!';
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
if (!isInitialized || !allReady) {
|
|
314
|
+
return (
|
|
315
|
+
<SplashScreen
|
|
316
|
+
appName="My App"
|
|
317
|
+
tagline={getTagline()}
|
|
318
|
+
gradientColors={['#667eea', '#764ba2']}
|
|
319
|
+
visible
|
|
320
|
+
/>
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return <MainApp />;
|
|
325
|
+
};
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Debug Modu
|
|
329
|
+
|
|
330
|
+
```tsx
|
|
331
|
+
export const DebugSplash = () => {
|
|
332
|
+
const [debugInfo, setDebugInfo] = useState({});
|
|
333
|
+
const { isInitialized } = useSplashFlow({ duration: 1000 });
|
|
334
|
+
|
|
335
|
+
useEffect(() => {
|
|
336
|
+
if (__DEV__) {
|
|
337
|
+
console.log('[Splash] Initializing...');
|
|
338
|
+
// Collect debug info
|
|
339
|
+
setDebugInfo({
|
|
340
|
+
version: '1.0.0',
|
|
341
|
+
env: 'development',
|
|
342
|
+
timestamp: Date.now(),
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}, []);
|
|
346
|
+
|
|
347
|
+
return (
|
|
348
|
+
<SplashScreen
|
|
349
|
+
appName="My App"
|
|
350
|
+
tagline={__DEV__ ? `Debug v${debugInfo.version}` : 'Welcome'}
|
|
351
|
+
maxDuration={3000}
|
|
352
|
+
onTimeout={() => {
|
|
353
|
+
if (__DEV__) {
|
|
354
|
+
console.error('[Splash] Initialization timeout!');
|
|
355
|
+
}
|
|
356
|
+
}}
|
|
357
|
+
visible={!isInitialized}
|
|
358
|
+
/>
|
|
359
|
+
);
|
|
360
|
+
};
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## Props
|
|
364
|
+
|
|
365
|
+
### SplashScreenProps
|
|
366
|
+
|
|
367
|
+
| Prop | Tip | Varsayılan | Açıklama |
|
|
368
|
+
|------|-----|------------|----------|
|
|
369
|
+
| `icon` | `ImageSourcePropType` | - | Logo/ikon |
|
|
370
|
+
| `appName` | `string` | - | Uygulama adı |
|
|
371
|
+
| `tagline` | `string` | - | Slogan |
|
|
372
|
+
| `colors` | `SplashColors` | - | Custom renkler |
|
|
373
|
+
| `gradientColors` | `string[]` | - | Gradient renkleri |
|
|
374
|
+
| `visible` | `boolean` | `true` | Görünürlük |
|
|
375
|
+
| `maxDuration` | `number` | - | Maksimum süre (ms) |
|
|
376
|
+
| `onTimeout` | `() => void` | - | Timeout callback |
|
|
377
|
+
| `onReady` | `() => void` | - | Ready callback |
|
|
378
|
+
| `style` | `ViewStyle` | - | Özel stil |
|
|
379
|
+
|
|
380
|
+
### SplashColors
|
|
381
|
+
|
|
382
|
+
| Prop | Tip | Varsayılan | Açıklama |
|
|
383
|
+
|------|-----|------------|----------|
|
|
384
|
+
| `background` | `string` | `tokens.colors.backgroundPrimary` | Arka plan rengi |
|
|
385
|
+
| `text` | `string` | `tokens.colors.textPrimary` | Metin rengi |
|
|
386
|
+
| `iconPlaceholder` | `string` | `text + 30% opacity` | İkon placeholder rengi |
|
|
387
|
+
|
|
388
|
+
### useSplashFlow Options
|
|
389
|
+
|
|
390
|
+
| Prop | Tip | Varsayılan | Açıklama |
|
|
391
|
+
|------|-----|------------|----------|
|
|
392
|
+
| `duration` | `number` | `1500` | Splash süresi (ms) |
|
|
393
|
+
|
|
394
|
+
## Best Practices
|
|
395
|
+
|
|
396
|
+
### 1. Süre Ayarı
|
|
397
|
+
|
|
398
|
+
```tsx
|
|
399
|
+
// Kısa
|
|
400
|
+
useSplashFlow({ duration: 1000 })
|
|
401
|
+
|
|
402
|
+
// Orta (önerilen)
|
|
403
|
+
useSplashFlow({ duration: 2000 })
|
|
404
|
+
|
|
405
|
+
// Uzun
|
|
406
|
+
useSplashFlow({ duration: 3000 })
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### 2. Timeout Kullanımı
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
<SplashScreen
|
|
413
|
+
maxDuration={5000}
|
|
414
|
+
onTimeout={() => {
|
|
415
|
+
// Fallback behavior
|
|
416
|
+
navigation.replace('Error');
|
|
417
|
+
}}
|
|
418
|
+
/>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### 3. Asset Preloading
|
|
422
|
+
|
|
423
|
+
```tsx
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
async function load() {
|
|
426
|
+
await Asset.loadAsync(require('./assets/logo.png'));
|
|
427
|
+
await Font.loadAsync({ font: require('./assets/font.ttf') });
|
|
428
|
+
setAssetsLoaded(true);
|
|
429
|
+
}
|
|
430
|
+
load();
|
|
431
|
+
}, []);
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### 4. Theme Awareness
|
|
435
|
+
|
|
436
|
+
```tsx
|
|
437
|
+
// Theme-aware colors (önerilen)
|
|
438
|
+
<SplashScreen appName="App" />
|
|
439
|
+
|
|
440
|
+
// Custom colors
|
|
441
|
+
<SplashScreen
|
|
442
|
+
colors={{
|
|
443
|
+
background: '#1a1a1a',
|
|
444
|
+
text: '#ffffff',
|
|
445
|
+
}}
|
|
446
|
+
/>
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Erişilebilirlik
|
|
450
|
+
|
|
451
|
+
SplashScreen, tam erişilebilirlik desteği sunar:
|
|
452
|
+
|
|
453
|
+
- ✅ Screen reader desteği
|
|
454
|
+
- ✅ Accessibility label
|
|
455
|
+
- ✅ Loading state anonsu
|
|
456
|
+
- ✅ Timeout bildirimi (DEV modunda)
|
|
457
|
+
|
|
458
|
+
## Performans İpuçları
|
|
459
|
+
|
|
460
|
+
1. **Preload Assets**: Splash'ta asset'leri preload edin
|
|
461
|
+
2. **Optimize**: Logo boyutunu optimize edin
|
|
462
|
+
3. **Timeout**: Maksimum süre belirleyin
|
|
463
|
+
4. **Async**: Asenkron işlemleri paralel yapın
|
|
464
|
+
5. **Minimal**: Gereksiz component'lerden kaçının
|
|
465
|
+
|
|
466
|
+
## İlgili Bileşenler
|
|
467
|
+
|
|
468
|
+
- [`AtomicSpinner`](../../atoms/AtomicSpinner/README.md) - Yükleme göstergesi
|
|
469
|
+
- [`AtomicText`](../../atoms/AtomicText/README.md) - Metin bileşeni
|
|
470
|
+
- [`BaseModal`](../BaseModal/README.md) - Modal bileşeni
|
|
471
|
+
|
|
472
|
+
## Lisans
|
|
473
|
+
|
|
474
|
+
MIT
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import React, { useEffect, useState, useCallback } from "react";
|
|
3
3
|
import { View, Image, StyleSheet } from "react-native";
|
|
4
|
-
import { LinearGradient } from "expo-linear-gradient";
|
|
5
4
|
import { useSafeAreaInsets } from "../../../safe-area";
|
|
6
5
|
import { AtomicText, AtomicSpinner } from "../../../atoms";
|
|
7
6
|
import { useAppDesignTokens } from "../../../theme";
|
|
@@ -128,19 +127,6 @@ export const SplashScreen: React.FC<SplashScreenProps> = ({
|
|
|
128
127
|
</View>
|
|
129
128
|
);
|
|
130
129
|
|
|
131
|
-
if (gradientColors && gradientColors.length >= 2) {
|
|
132
|
-
return (
|
|
133
|
-
<LinearGradient
|
|
134
|
-
colors={gradientColors as [string, string, ...string[]]}
|
|
135
|
-
style={[styles.container, style]}
|
|
136
|
-
start={{ x: 0, y: 0 }}
|
|
137
|
-
end={{ x: 0, y: 1 }}
|
|
138
|
-
>
|
|
139
|
-
{content}
|
|
140
|
-
</LinearGradient>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
130
|
return (
|
|
145
131
|
<View style={[styles.container, { backgroundColor: colors.background }, style]}>
|
|
146
132
|
{content}
|