@umituz/react-native-exception 1.2.2 → 1.2.3

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-exception",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Exception handling and error tracking for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
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
 
@@ -122,3 +122,13 @@ export class ExceptionReporter {
122
122
  this.config = { ...this.config, ...config };
123
123
  }
124
124
  }
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
@@ -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
+ });