@umituz/react-native-exception 1.2.2 → 1.2.5
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/LICENSE +0 -0
- package/README.md +0 -0
- package/package.json +1 -2
- package/src/domain/entities/ExceptionEntity.ts +0 -0
- package/src/domain/repositories/IExceptionRepository.ts +0 -0
- package/src/index.ts +2 -0
- package/src/infrastructure/services/ExceptionHandler.ts +0 -0
- package/src/infrastructure/services/ExceptionLogger.ts +0 -0
- package/src/infrastructure/services/ExceptionReporter.ts +10 -0
- package/src/infrastructure/services/ExceptionService.ts +0 -0
- package/src/infrastructure/storage/ExceptionStore.ts +0 -0
- package/src/presentation/components/EmptyState.tsx +0 -0
- package/src/presentation/components/ErrorBoundary.tsx +0 -0
- package/src/presentation/components/ErrorState.tsx +113 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-exception",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Exception handling and error tracking for React Native apps",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
8
|
"typecheck": "tsc --noEmit",
|
|
10
9
|
"lint": "tsc --noEmit",
|
|
11
10
|
"clean": "rm -rf lib",
|
|
File without changes
|
|
File without changes
|
package/src/index.ts
CHANGED
|
@@ -54,6 +54,8 @@ export { ExceptionLogger } from './infrastructure/services/ExceptionLogger';
|
|
|
54
54
|
export { ErrorBoundary } from './presentation/components/ErrorBoundary';
|
|
55
55
|
export { EmptyState } from './presentation/components/EmptyState';
|
|
56
56
|
export type { EmptyStateProps } from './presentation/components/EmptyState';
|
|
57
|
+
export { ErrorState } from './presentation/components/ErrorState';
|
|
58
|
+
export type { ErrorStateProps } from './presentation/components/ErrorState';
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error State Component
|
|
3
|
+
* Generic error display with retry action
|
|
4
|
+
*
|
|
5
|
+
* Presentation Layer - UI Component
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { View, StyleSheet, TouchableOpacity } from "react-native";
|
|
10
|
+
import {
|
|
11
|
+
AtomicIcon,
|
|
12
|
+
AtomicText,
|
|
13
|
+
useAppDesignTokens,
|
|
14
|
+
STATIC_TOKENS,
|
|
15
|
+
} from "@umituz/react-native-design-system";
|
|
16
|
+
|
|
17
|
+
export interface ErrorStateProps {
|
|
18
|
+
/** Icon name from lucide-react-native */
|
|
19
|
+
icon?: string;
|
|
20
|
+
/** Error title */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Error description */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Retry button label */
|
|
25
|
+
actionLabel?: string;
|
|
26
|
+
/** Retry action callback */
|
|
27
|
+
onAction?: () => void;
|
|
28
|
+
/** Custom illustration instead of icon */
|
|
29
|
+
illustration?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const ErrorState: React.FC<ErrorStateProps> = ({
|
|
33
|
+
icon = "AlertCircle",
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
actionLabel,
|
|
37
|
+
onAction,
|
|
38
|
+
illustration,
|
|
39
|
+
}) => {
|
|
40
|
+
const tokens = useAppDesignTokens();
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View style={styles.container}>
|
|
44
|
+
{illustration ? (
|
|
45
|
+
illustration
|
|
46
|
+
) : (
|
|
47
|
+
<View
|
|
48
|
+
style={[styles.iconContainer, { backgroundColor: tokens.colors.surface }]}
|
|
49
|
+
>
|
|
50
|
+
<AtomicIcon name={icon} size="xxl" color="secondary" />
|
|
51
|
+
</View>
|
|
52
|
+
)}
|
|
53
|
+
|
|
54
|
+
<AtomicText type="headlineSmall" color="primary" style={styles.title}>
|
|
55
|
+
{title}
|
|
56
|
+
</AtomicText>
|
|
57
|
+
|
|
58
|
+
{description && (
|
|
59
|
+
<AtomicText type="bodyMedium" color="secondary" style={styles.description}>
|
|
60
|
+
{description}
|
|
61
|
+
</AtomicText>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
{actionLabel && onAction && (
|
|
65
|
+
<TouchableOpacity
|
|
66
|
+
style={[styles.actionButton, { backgroundColor: tokens.colors.primary }]}
|
|
67
|
+
onPress={onAction}
|
|
68
|
+
activeOpacity={0.8}
|
|
69
|
+
>
|
|
70
|
+
<AtomicIcon name="RefreshCw" size="sm" color="onPrimary" />
|
|
71
|
+
<AtomicText type="labelLarge" color="onPrimary">
|
|
72
|
+
{actionLabel}
|
|
73
|
+
</AtomicText>
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
)}
|
|
76
|
+
</View>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
container: {
|
|
82
|
+
flex: 1,
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
justifyContent: "center",
|
|
85
|
+
padding: STATIC_TOKENS.spacing.xl,
|
|
86
|
+
},
|
|
87
|
+
iconContainer: {
|
|
88
|
+
width: 120,
|
|
89
|
+
height: 120,
|
|
90
|
+
borderRadius: 60,
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
justifyContent: "center",
|
|
93
|
+
marginBottom: STATIC_TOKENS.spacing.lg,
|
|
94
|
+
},
|
|
95
|
+
title: {
|
|
96
|
+
marginBottom: STATIC_TOKENS.spacing.sm,
|
|
97
|
+
textAlign: "center",
|
|
98
|
+
},
|
|
99
|
+
description: {
|
|
100
|
+
marginBottom: STATIC_TOKENS.spacing.lg,
|
|
101
|
+
maxWidth: 280,
|
|
102
|
+
textAlign: "center",
|
|
103
|
+
},
|
|
104
|
+
actionButton: {
|
|
105
|
+
flexDirection: "row",
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
paddingHorizontal: STATIC_TOKENS.spacing.lg,
|
|
108
|
+
paddingVertical: STATIC_TOKENS.spacing.md,
|
|
109
|
+
borderRadius: STATIC_TOKENS.borders.radius.full,
|
|
110
|
+
marginTop: STATIC_TOKENS.spacing.sm,
|
|
111
|
+
gap: STATIC_TOKENS.spacing.sm,
|
|
112
|
+
},
|
|
113
|
+
});
|