@umituz/react-native-settings 4.20.56 → 4.20.57

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.
Files changed (47) hide show
  1. package/README.md +145 -3
  2. package/package.json +1 -2
  3. package/src/application/README.md +322 -0
  4. package/src/domains/about/README.md +452 -0
  5. package/src/domains/about/presentation/hooks/README.md +350 -0
  6. package/src/domains/appearance/README.md +596 -0
  7. package/src/domains/appearance/hooks/README.md +366 -0
  8. package/src/domains/appearance/infrastructure/services/README.md +455 -0
  9. package/src/domains/cloud-sync/README.md +451 -0
  10. package/src/domains/cloud-sync/presentation/components/README.md +493 -0
  11. package/src/domains/dev/README.md +477 -0
  12. package/src/domains/disclaimer/README.md +421 -0
  13. package/src/domains/disclaimer/presentation/components/README.md +394 -0
  14. package/src/domains/faqs/README.md +586 -0
  15. package/src/domains/feedback/README.md +565 -0
  16. package/src/domains/feedback/presentation/hooks/README.md +428 -0
  17. package/src/domains/legal/README.md +549 -0
  18. package/src/domains/rating/README.md +452 -0
  19. package/src/domains/rating/presentation/components/README.md +475 -0
  20. package/src/domains/video-tutorials/README.md +482 -0
  21. package/src/domains/video-tutorials/presentation/components/README.md +433 -0
  22. package/src/infrastructure/README.md +509 -0
  23. package/src/infrastructure/repositories/README.md +475 -0
  24. package/src/infrastructure/services/README.md +510 -0
  25. package/src/presentation/components/README.md +482 -0
  26. package/src/presentation/components/SettingsErrorBoundary/README.md +461 -0
  27. package/src/presentation/components/SettingsFooter/README.md +446 -0
  28. package/src/presentation/components/SettingsItemCard/README.md +457 -0
  29. package/src/presentation/components/SettingsSection/README.md +421 -0
  30. package/src/presentation/hooks/README.md +413 -0
  31. package/src/presentation/hooks/mutations/README.md +430 -0
  32. package/src/presentation/hooks/queries/README.md +441 -0
  33. package/src/presentation/navigation/README.md +532 -0
  34. package/src/presentation/navigation/components/README.md +330 -0
  35. package/src/presentation/navigation/hooks/README.md +399 -0
  36. package/src/presentation/navigation/utils/README.md +442 -0
  37. package/src/presentation/screens/README.md +525 -0
  38. package/src/presentation/screens/components/SettingsContent/README.md +404 -0
  39. package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
  40. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
  41. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
  42. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
  43. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
  44. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
  45. package/src/presentation/screens/hooks/README.md +383 -0
  46. package/src/presentation/screens/types/README.md +439 -0
  47. package/src/presentation/screens/utils/README.md +288 -0
@@ -0,0 +1,461 @@
1
+ # Settings Error Boundary
2
+
3
+ Error boundary component for catching and handling errors in settings screens and components.
4
+
5
+ ## Features
6
+
7
+ - **Error Catching**: Catches JavaScript errors in component tree
8
+ - **Fallback UI**: Displays user-friendly error messages
9
+ - **Error Reporting**: Integrates with error tracking services
10
+ - **Recovery Options**: Provide retry or reset actions
11
+ - **Development Mode**: Detailed error info in development
12
+
13
+ ## Installation
14
+
15
+ This component is part of `@umituz/react-native-settings`.
16
+
17
+ ## Usage
18
+
19
+ ### Basic Usage
20
+
21
+ ```tsx
22
+ import { SettingsErrorBoundary } from '@umituz/react-native-settings';
23
+
24
+ function App() {
25
+ return (
26
+ <SettingsErrorBoundary>
27
+ <SettingsScreen />
28
+ </SettingsErrorBoundary>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ### With Custom Fallback
34
+
35
+ ```tsx
36
+ function App() {
37
+ return (
38
+ <SettingsErrorBoundary
39
+ fallback={<ErrorFallback />}
40
+ onError={(error) => console.error(error)}
41
+ >
42
+ <SettingsScreen />
43
+ </SettingsErrorBoundary>
44
+ );
45
+ }
46
+
47
+ function ErrorFallback() {
48
+ return (
49
+ <View style={styles.container}>
50
+ <Text>Something went wrong</Text>
51
+ <Button title="Retry" onPress={() => window.location.reload()} />
52
+ </View>
53
+ );
54
+ }
55
+ ```
56
+
57
+ ### With Recovery Actions
58
+
59
+ ```tsx
60
+ function App() {
61
+ const handleReset = () => {
62
+ // Clear cache
63
+ clearSettingsCache();
64
+ // Reload app
65
+ Updates.reloadAsync();
66
+ };
67
+
68
+ return (
69
+ <SettingsErrorBoundary
70
+ onReset={handleReset}
71
+ fallback={({ error, resetError }) => (
72
+ <ErrorFallback error={error} onReset={resetError} />
73
+ )}
74
+ >
75
+ <SettingsScreen />
76
+ </SettingsErrorBoundary>
77
+ );
78
+ }
79
+ ```
80
+
81
+ ## Props
82
+
83
+ ### SettingsErrorBoundaryProps
84
+
85
+ | Prop | Type | Default | Description |
86
+ |------|------|---------|-------------|
87
+ | `children` | `ReactNode` | **Required** | Component tree to wrap |
88
+ | `fallback` | `ReactNode \| FallbackRender` | Default fallback | Fallback UI when error occurs |
89
+ | `onError` | `(error: Error) => void` | `undefined` | Error callback |
90
+ | `onReset` | `() => void` | `undefined` | Reset callback |
91
+ | `retryButton` | `boolean` | `true` | Show retry button |
92
+ | `showDetails` | `boolean` | `__DEV__` | Show error details |
93
+
94
+ ### FallbackRender
95
+
96
+ ```typescript
97
+ type FallbackRender = (props: {
98
+ error: Error;
99
+ resetError: () => void;
100
+ }) => ReactNode;
101
+ ```
102
+
103
+ ## Fallback Component
104
+
105
+ ### Default Fallback
106
+
107
+ ```tsx
108
+ <SettingsErrorBoundary>
109
+ <SettingsScreen />
110
+ </SettingsErrorBoundary>
111
+
112
+ // Renders on error:
113
+ // ┌────────────────────────────┐
114
+ // │ │
115
+ // │ ⚠️ Error │
116
+ // │ │
117
+ // │ Something went wrong │
118
+ // │ while loading settings │
119
+ // │ │
120
+ // │ [Try Again] │
121
+ // │ │
122
+ // └────────────────────────────┘
123
+ ```
124
+
125
+ ### Custom Fallback
126
+
127
+ ```tsx
128
+ function CustomFallback({ error, resetError }) {
129
+ return (
130
+ <View style={styles.container}>
131
+ <View style={styles.iconContainer}>
132
+ <Ionicons name="alert-circle-outline" size={64} color="red" />
133
+ </View>
134
+
135
+ <Text style={styles.title}>Oops! Something went wrong</Text>
136
+
137
+ <Text style={styles.message}>
138
+ {error.message || 'An unexpected error occurred'}
139
+ </Text>
140
+
141
+ {__DEV__ && (
142
+ <Text style={styles.details}>
143
+ {error.stack}
144
+ </Text>
145
+ )}
146
+
147
+ <Button
148
+ title="Try Again"
149
+ onPress={resetError}
150
+ style={styles.button}
151
+ />
152
+
153
+ <Button
154
+ title="Go Back"
155
+ onPress={() => navigation.goBack()}
156
+ variant="secondary"
157
+ />
158
+ </View>
159
+ );
160
+ }
161
+ ```
162
+
163
+ ## Usage Examples
164
+
165
+ ### With Error Reporting
166
+
167
+ ```tsx
168
+ function App() {
169
+ const reportError = (error: Error) => {
170
+ // Log to error tracking service
171
+ Sentry.captureException(error);
172
+
173
+ // Log to console
174
+ console.error('Settings error:', error);
175
+
176
+ // Report to analytics
177
+ Analytics.track('settings_error', {
178
+ message: error.message,
179
+ stack: error.stack,
180
+ });
181
+ };
182
+
183
+ return (
184
+ <SettingsErrorBoundary onError={reportError}>
185
+ <SettingsScreen />
186
+ </SettingsErrorBoundary>
187
+ );
188
+ }
189
+ ```
190
+
191
+ ### With Context Recovery
192
+
193
+ ```tsx
194
+ function SettingsWithRecovery() {
195
+ const [hasError, setHasError] = useState(false);
196
+ const [error, setError] = useState<Error | null>(null);
197
+
198
+ const handleReset = useCallback(() => {
199
+ setHasError(false);
200
+ setError(null);
201
+ }, []);
202
+
203
+ if (hasError) {
204
+ return (
205
+ <ErrorFallback
206
+ error={error}
207
+ onReset={handleReset}
208
+ />
209
+ );
210
+ }
211
+
212
+ return (
213
+ <SettingsErrorBoundary
214
+ onError={(error) => {
215
+ setHasError(true);
216
+ setError(error);
217
+ }}
218
+ >
219
+ <SettingsScreen />
220
+ </SettingsErrorBoundary>
221
+ );
222
+ }
223
+ ```
224
+
225
+ ### With Automatic Retry
226
+
227
+ ```tsx
228
+ function AutoRetryBoundary() {
229
+ const [retryCount, setRetryCount] = useState(0);
230
+ const maxRetries = 3;
231
+
232
+ const handleError = (error: Error) => {
233
+ if (retryCount < maxRetries) {
234
+ setTimeout(() => {
235
+ setRetryCount(prev => prev + 1);
236
+ }, 1000);
237
+ } else {
238
+ Alert.alert('Error', 'Failed after multiple retries');
239
+ }
240
+ };
241
+
242
+ return (
243
+ <SettingsErrorBoundary
244
+ onError={handleError}
245
+ key={retryCount} // Force remount on retry
246
+ >
247
+ <SettingsScreen />
248
+ </SettingsErrorBoundary>
249
+ );
250
+ }
251
+ ```
252
+
253
+ ### Conditional Error Boundary
254
+
255
+ ```tsx
256
+ function ConditionalBoundary({ enabled, children }) {
257
+ if (!enabled) {
258
+ return <>{children}</>;
259
+ }
260
+
261
+ return (
262
+ <SettingsErrorBoundary>
263
+ {children}
264
+ </SettingsErrorBoundary>
265
+ );
266
+ }
267
+
268
+ // Usage
269
+ <ConditionalBoundary enabled={__DEV__}>
270
+ <SettingsScreen />
271
+ </ConditionalBoundary>
272
+ ```
273
+
274
+ ## Error States
275
+
276
+ ### Loading State Error
277
+
278
+ ```tsx
279
+ function LoadingBoundary() {
280
+ return (
281
+ <SettingsErrorBoundary
282
+ fallback={({ resetError }) => (
283
+ <View style={styles.container}>
284
+ <Text>Failed to load settings</Text>
285
+ <Button
286
+ title="Retry"
287
+ onPress={resetError}
288
+ />
289
+ </View>
290
+ )}
291
+ >
292
+ <SettingsScreen />
293
+ </SettingsErrorBoundary>
294
+ );
295
+ }
296
+ ```
297
+
298
+ ### Mutation Error
299
+
300
+ ```tsx
301
+ function MutationBoundary() {
302
+ return (
303
+ <SettingsErrorBoundary
304
+ fallback={({ error, resetError }) => (
305
+ <View style={styles.container}>
306
+ <Text>Failed to update settings</Text>
307
+ <Text>{error.message}</Text>
308
+ <Button
309
+ title="Cancel"
310
+ onPress={() => navigation.goBack()}
311
+ />
312
+ <Button
313
+ title="Retry"
314
+ onPress={resetError}
315
+ />
316
+ </View>
317
+ )}
318
+ >
319
+ <SettingsForm />
320
+ </SettingsErrorBoundary>
321
+ );
322
+ }
323
+ ```
324
+
325
+ ### Navigation Error
326
+
327
+ ```tsx
328
+ function NavigationBoundary() {
329
+ return (
330
+ <SettingsErrorBoundary
331
+ fallback={({ error }) => (
332
+ <View style={styles.container}>
333
+ <Text>Navigation error occurred</Text>
334
+ <Button
335
+ title="Go Back"
336
+ onPress={() => navigation.goBack()}
337
+ />
338
+ <Button
339
+ title="Home"
340
+ onPress={() => navigation.navigate('Home')}
341
+ />
342
+ </View>
343
+ )}
344
+ >
345
+ <SettingsNavigator />
346
+ </SettingsErrorBoundary>
347
+ );
348
+ }
349
+ ```
350
+
351
+ ## Styling
352
+
353
+ ### Custom Styles
354
+
355
+ ```tsx
356
+ function StyledFallback({ error, resetError }) {
357
+ return (
358
+ <View style={styles.container}>
359
+ <LinearGradient
360
+ colors={['#667eea', '#764ba2']}
361
+ style={styles.gradient}
362
+ >
363
+ <View style={styles.content}>
364
+ <Ionicons
365
+ name="warning-outline"
366
+ size={80}
367
+ color="white"
368
+ style={styles.icon}
369
+ />
370
+
371
+ <Text style={styles.title}>Oops!</Text>
372
+
373
+ <Text style={styles.message}>
374
+ Something went wrong
375
+ </Text>
376
+
377
+ {__DEV__ && (
378
+ <View style={styles.details}>
379
+ <Text style={styles.errorText}>
380
+ {error.message}
381
+ </Text>
382
+ </View>
383
+ )}
384
+
385
+ <TouchableOpacity
386
+ style={styles.button}
387
+ onPress={resetError}
388
+ >
389
+ <Text style={styles.buttonText}>Try Again</Text>
390
+ </TouchableOpacity>
391
+ </View>
392
+ </LinearGradient>
393
+ </View>
394
+ );
395
+ }
396
+
397
+ const styles = StyleSheet.create({
398
+ container: { flex: 1 },
399
+ gradient: { flex: 1 },
400
+ content: {
401
+ flex: 1,
402
+ justifyContent: 'center',
403
+ alignItems: 'center',
404
+ padding: 20,
405
+ },
406
+ icon: { marginBottom: 20 },
407
+ title: {
408
+ fontSize: 32,
409
+ fontWeight: 'bold',
410
+ color: 'white',
411
+ marginBottom: 10,
412
+ },
413
+ message: {
414
+ fontSize: 16,
415
+ color: 'white',
416
+ textAlign: 'center',
417
+ marginBottom: 20,
418
+ },
419
+ details: {
420
+ backgroundColor: 'rgba(0,0,0,0.2)',
421
+ padding: 10,
422
+ borderRadius: 8,
423
+ marginBottom: 20,
424
+ },
425
+ errorText: {
426
+ color: 'white',
427
+ fontSize: 12,
428
+ fontFamily: 'monospace',
429
+ },
430
+ button: {
431
+ backgroundColor: 'white',
432
+ paddingHorizontal: 30,
433
+ paddingVertical: 15,
434
+ borderRadius: 25,
435
+ },
436
+ buttonText: {
437
+ color: '#667eea',
438
+ fontWeight: 'bold',
439
+ },
440
+ });
441
+ ```
442
+
443
+ ## Best Practices
444
+
445
+ 1. **Wrap Strategically**: Place boundaries at strategic locations
446
+ 2. **Custom Fallbacks**: Provide context-specific fallbacks
447
+ 3. **Error Reporting**: Integrate with error tracking services
448
+ 4. **Recovery Actions**: Offer retry or reset options
449
+ 5. **Development Details**: Show details only in development
450
+ 6. **User-Friendly**: Use clear, non-technical error messages
451
+ 7. **Logging**: Always log errors for debugging
452
+
453
+ ## Related
454
+
455
+ - **SettingsScreen**: Main screen component
456
+ - **SettingsContent**: Content component
457
+ - **React Error Boundaries**: Official React documentation
458
+
459
+ ## License
460
+
461
+ MIT