@umituz/react-native-settings 4.23.70 → 4.23.72
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.72",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -91,7 +91,6 @@ export type { SettingsSectionProps } from './presentation/components/SettingsSec
|
|
|
91
91
|
export { SettingsFooter } from './presentation/components/SettingsFooter';
|
|
92
92
|
export type { SettingsFooterProps } from './presentation/components/SettingsFooter';
|
|
93
93
|
|
|
94
|
-
export { SettingsErrorBoundary } from './presentation/components/SettingsErrorBoundary';
|
|
95
94
|
|
|
96
95
|
|
|
97
96
|
// =============================================================================
|
|
@@ -7,10 +7,10 @@ import React from "react";
|
|
|
7
7
|
import {
|
|
8
8
|
ScreenLayout,
|
|
9
9
|
useAppNavigation,
|
|
10
|
+
ErrorBoundary,
|
|
10
11
|
} from "@umituz/react-native-design-system";
|
|
11
12
|
import { SettingsHeader } from "./components/SettingsHeader";
|
|
12
13
|
import { SettingsContent } from "./components/SettingsContent";
|
|
13
|
-
import { SettingsErrorBoundary } from "../components/SettingsErrorBoundary";
|
|
14
14
|
import { normalizeSettingsConfig } from "./utils/normalizeConfig";
|
|
15
15
|
import { useFeatureDetection } from "./hooks/useFeatureDetection";
|
|
16
16
|
import type { SettingsConfig, CustomSettingsSection } from "./types";
|
|
@@ -95,7 +95,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
95
95
|
// Workaround: Use conditional rendering with type assertion
|
|
96
96
|
if (showHeader) {
|
|
97
97
|
return <ScreenLayout header={<SettingsHeader showCloseButton={showCloseButton} onClose={onClose} />}>
|
|
98
|
-
<
|
|
98
|
+
<ErrorBoundary>
|
|
99
99
|
{children ?? (
|
|
100
100
|
<SettingsContent
|
|
101
101
|
normalizedConfig={normalizedConfig}
|
|
@@ -110,12 +110,12 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
110
110
|
gamificationConfig={gamificationConfig}
|
|
111
111
|
/>
|
|
112
112
|
)}
|
|
113
|
-
</
|
|
113
|
+
</ErrorBoundary>
|
|
114
114
|
</ScreenLayout>;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
return <ScreenLayout>
|
|
118
|
-
<
|
|
118
|
+
<ErrorBoundary>
|
|
119
119
|
{children ?? (
|
|
120
120
|
<SettingsContent
|
|
121
121
|
normalizedConfig={normalizedConfig}
|
|
@@ -130,6 +130,6 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
|
|
|
130
130
|
gamificationConfig={gamificationConfig}
|
|
131
131
|
/>
|
|
132
132
|
)}
|
|
133
|
-
</
|
|
133
|
+
</ErrorBoundary>
|
|
134
134
|
</ScreenLayout>;
|
|
135
135
|
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Settings Error Boundary
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
Error boundary component for catching and handling errors in settings screens and components, providing fallback UI and error recovery options.
|
|
6
|
-
|
|
7
|
-
## File Paths
|
|
8
|
-
|
|
9
|
-
- **Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/components/SettingsErrorBoundary/SettingsErrorBoundary.tsx`
|
|
10
|
-
|
|
11
|
-
## Strategy
|
|
12
|
-
|
|
13
|
-
1. **Error Containment**: Catches JavaScript errors in the component tree below it, preventing app crashes
|
|
14
|
-
2. **User-Friendly Fallback**: Displays clear, non-technical error messages to users
|
|
15
|
-
3. **Error Recovery**: Provides retry or reset actions to recover from errors
|
|
16
|
-
4. **Development Support**: Shows detailed error information in development mode for debugging
|
|
17
|
-
5. **Error Reporting**: Integrates with error tracking services for monitoring
|
|
18
|
-
|
|
19
|
-
## Restrictions (Forbidden)
|
|
20
|
-
|
|
21
|
-
### DO NOT
|
|
22
|
-
- ❌ DO NOT wrap individual small components (use at screen or major section level)
|
|
23
|
-
- ❌ DO NOT use error boundaries to handle expected errors (e.g., network failures)
|
|
24
|
-
- ❌ DO NOT show technical stack traces to end users in production
|
|
25
|
-
|
|
26
|
-
### NEVER
|
|
27
|
-
- ❌ NEVER use error boundaries inside event handlers or async code
|
|
28
|
-
- ❌ NEVER use error boundaries to control flow or business logic
|
|
29
|
-
- ❌ NEVER expose sensitive information in error messages
|
|
30
|
-
|
|
31
|
-
### AVOID
|
|
32
|
-
- ❌ AVOID nesting multiple error boundaries without clear purpose
|
|
33
|
-
- ❌ AVOID generic error messages that don't help users understand what happened
|
|
34
|
-
- ❌ AVOID blocking the entire app when a recoverable error occurs
|
|
35
|
-
|
|
36
|
-
## Rules (Mandatory)
|
|
37
|
-
|
|
38
|
-
### ALWAYS
|
|
39
|
-
- ✅ ALWAYS provide a clear fallback UI when errors occur
|
|
40
|
-
- ✅ ALWAYS log errors for debugging and monitoring
|
|
41
|
-
- ✅ ALWAYS integrate with error tracking services (e.g., Sentry)
|
|
42
|
-
- ✅ ALWAYS show user-friendly error messages in production
|
|
43
|
-
|
|
44
|
-
### MUST
|
|
45
|
-
- ✅ MUST offer recovery options (retry, reset, or navigation) to users
|
|
46
|
-
- ✅ MUST ensure error boundaries don't interfere with normal error handling
|
|
47
|
-
- ✅ MUST test error scenarios during development
|
|
48
|
-
|
|
49
|
-
### SHOULD
|
|
50
|
-
- ✅ SHOULD provide context-specific error messages when possible
|
|
51
|
-
- ✅ SHOULD include development-only error details for debugging
|
|
52
|
-
- ✅ SHOULD offer a way to report errors or contact support
|
|
53
|
-
|
|
54
|
-
## AI Agent Guidelines
|
|
55
|
-
|
|
56
|
-
1. **File Reference**: When implementing error handling, refer to `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/components/SettingsErrorBoundary/SettingsErrorBoundary.tsx`
|
|
57
|
-
2. **Placement Strategy**: Place error boundaries at strategic locations (screen level, major feature sections)
|
|
58
|
-
3. **Fallback Design**: Design fallback UIs that match your app's visual design
|
|
59
|
-
4. **Error Tracking**: Always integrate with error tracking services like Sentry or Crashlytics
|
|
60
|
-
5. **Recovery Logic**: Implement appropriate recovery actions based on error type and context
|
|
61
|
-
|
|
62
|
-
## Component Reference
|
|
63
|
-
|
|
64
|
-
Related components:
|
|
65
|
-
- **SettingsScreen**: Main screen component that uses error boundaries
|
|
66
|
-
- **SettingsContent**: Content component wrapped by error boundaries
|
|
67
|
-
- **React Error Boundaries**: Official React documentation for error boundaries
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings Error Boundary Component
|
|
3
|
-
* Catches and handles errors in settings components
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { Component, ReactNode } from 'react';
|
|
7
|
-
import { View, StyleSheet } from 'react-native';
|
|
8
|
-
import { useAppDesignTokens } from '@umituz/react-native-design-system';
|
|
9
|
-
import { AtomicText, AtomicIcon } from '@umituz/react-native-design-system';
|
|
10
|
-
import { useLocalization } from '../../domains/localization';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
fallback?: ReactNode;
|
|
15
|
-
fallbackTitle?: string;
|
|
16
|
-
fallbackMessage?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface State {
|
|
20
|
-
hasError: boolean;
|
|
21
|
-
error?: Error;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export class SettingsErrorBoundary extends Component<Props, State> {
|
|
25
|
-
override state: State = {
|
|
26
|
-
hasError: false,
|
|
27
|
-
error: undefined,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
static getDerivedStateFromError(error: Error): State {
|
|
31
|
-
return { hasError: true, error };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
|
|
35
|
-
// Log error to console in development
|
|
36
|
-
if (__DEV__) {
|
|
37
|
-
console.error('Settings Error Boundary caught an error:', error);
|
|
38
|
-
console.error('Error Info:', errorInfo);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// TODO: Send to error tracking service in production
|
|
42
|
-
// Example: Sentry.captureException(error, { contexts: { react: { errorInfo } } });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
override render(): ReactNode {
|
|
46
|
-
const { hasError, error } = this.state;
|
|
47
|
-
const { children, fallback, fallbackTitle, fallbackMessage } = this.props;
|
|
48
|
-
|
|
49
|
-
if (hasError) {
|
|
50
|
-
if (fallback) {
|
|
51
|
-
return fallback;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<ErrorBoundaryFallback
|
|
56
|
-
error={error}
|
|
57
|
-
fallbackTitle={fallbackTitle}
|
|
58
|
-
fallbackMessage={fallbackMessage}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return children;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface ErrorBoundaryFallbackProps {
|
|
68
|
-
error?: Error;
|
|
69
|
-
fallbackTitle?: string;
|
|
70
|
-
fallbackMessage?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const ErrorBoundaryFallback: React.FC<ErrorBoundaryFallbackProps> = ({
|
|
74
|
-
error,
|
|
75
|
-
fallbackTitle,
|
|
76
|
-
fallbackMessage
|
|
77
|
-
}) => {
|
|
78
|
-
const tokens = useAppDesignTokens();
|
|
79
|
-
const { t } = useLocalization();
|
|
80
|
-
|
|
81
|
-
const title = __DEV__ && error?.message
|
|
82
|
-
? t("error_boundary.dev_title")
|
|
83
|
-
: (fallbackTitle || t("error_boundary.title"));
|
|
84
|
-
|
|
85
|
-
const message = __DEV__ && error?.message
|
|
86
|
-
? `${t("error_boundary.dev_message")}: ${error.message}`
|
|
87
|
-
: (fallbackMessage || t("error_boundary.message"));
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
91
|
-
<View style={[styles.content, { backgroundColor: tokens.colors.surface }]}>
|
|
92
|
-
<AtomicIcon
|
|
93
|
-
name="alert-circle"
|
|
94
|
-
color="warning"
|
|
95
|
-
size="lg"
|
|
96
|
-
style={styles.icon}
|
|
97
|
-
/>
|
|
98
|
-
<AtomicText
|
|
99
|
-
type="headlineSmall"
|
|
100
|
-
color="primary"
|
|
101
|
-
style={styles.title}
|
|
102
|
-
>
|
|
103
|
-
{title}
|
|
104
|
-
</AtomicText>
|
|
105
|
-
<AtomicText
|
|
106
|
-
type="bodyMedium"
|
|
107
|
-
color="secondary"
|
|
108
|
-
style={styles.message}
|
|
109
|
-
>
|
|
110
|
-
{message}
|
|
111
|
-
</AtomicText>
|
|
112
|
-
</View>
|
|
113
|
-
</View>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const styles = StyleSheet.create({
|
|
118
|
-
container: {
|
|
119
|
-
flex: 1,
|
|
120
|
-
padding: 16,
|
|
121
|
-
justifyContent: 'center',
|
|
122
|
-
},
|
|
123
|
-
content: {
|
|
124
|
-
alignItems: 'center',
|
|
125
|
-
padding: 24,
|
|
126
|
-
borderRadius: 12,
|
|
127
|
-
},
|
|
128
|
-
icon: {
|
|
129
|
-
marginBottom: 16,
|
|
130
|
-
},
|
|
131
|
-
title: {
|
|
132
|
-
marginBottom: 8,
|
|
133
|
-
textAlign: 'center',
|
|
134
|
-
},
|
|
135
|
-
message: {
|
|
136
|
-
textAlign: 'center',
|
|
137
|
-
lineHeight: 20,
|
|
138
|
-
},
|
|
139
|
-
});
|