@umituz/react-native-design-system 2.8.22 → 2.8.24
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-design-system",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.24",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, and onboarding utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { Component, ReactNode } from 'react';
|
|
7
|
-
import { View,
|
|
7
|
+
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
8
|
+
import { AtomicText } from '../../../atoms';
|
|
8
9
|
import { exceptionService } from '../../infrastructure/services/ExceptionService';
|
|
9
10
|
import { useAppDesignTokens } from '../../../theme';
|
|
10
11
|
|
|
@@ -35,7 +36,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
|
|
39
|
+
override componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
|
|
39
40
|
// Log error to exception service
|
|
40
41
|
exceptionService.handleFatalError(error, {
|
|
41
42
|
componentStack: errorInfo.componentStack ?? undefined,
|
|
@@ -55,7 +56,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
55
56
|
});
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
render(): ReactNode {
|
|
59
|
+
override render(): ReactNode {
|
|
59
60
|
if (this.state.hasError) {
|
|
60
61
|
if (this.props.fallback) {
|
|
61
62
|
return this.props.fallback;
|
|
@@ -81,12 +82,12 @@ const ErrorDisplay: React.FC<ErrorDisplayProps> = ({ error, onReset }) => {
|
|
|
81
82
|
|
|
82
83
|
return (
|
|
83
84
|
<View style={styles.container}>
|
|
84
|
-
<
|
|
85
|
-
<
|
|
85
|
+
<AtomicText style={styles.title}>Something went wrong</AtomicText>
|
|
86
|
+
<AtomicText style={styles.message}>
|
|
86
87
|
{error?.message || 'An unexpected error occurred'}
|
|
87
|
-
</
|
|
88
|
+
</AtomicText>
|
|
88
89
|
<TouchableOpacity style={styles.button} onPress={onReset}>
|
|
89
|
-
<
|
|
90
|
+
<AtomicText style={styles.buttonText}>Try Again</AtomicText>
|
|
90
91
|
</TouchableOpacity>
|
|
91
92
|
</View>
|
|
92
93
|
);
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* Single Responsibility: Read files from device storage
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as FileSystem from "expo-file-system/legacy";
|
|
7
7
|
import type { FileEncoding } from "../../domain/entities/File";
|
|
8
|
-
import { blobToBase64 } from "../utils/blob.utils";
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Read file as string with encoding
|
|
@@ -15,29 +14,9 @@ export async function readFile(
|
|
|
15
14
|
encoding: FileEncoding = "utf8",
|
|
16
15
|
): Promise<string | null> {
|
|
17
16
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const response = await fetch(uri);
|
|
22
|
-
if (response.ok) {
|
|
23
|
-
if (encoding === "base64") {
|
|
24
|
-
const blob = await response.blob();
|
|
25
|
-
return await blobToBase64(blob);
|
|
26
|
-
}
|
|
27
|
-
return await response.text();
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
// Fall through to FileSystem API
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Use FileSystem API as fallback
|
|
35
|
-
const file = new File(uri);
|
|
36
|
-
if (encoding === "base64") {
|
|
37
|
-
const content = await file.base64();
|
|
38
|
-
return content;
|
|
39
|
-
}
|
|
40
|
-
const content = await file.text();
|
|
17
|
+
const content = await FileSystem.readAsStringAsync(uri, {
|
|
18
|
+
encoding: encoding === "base64" ? FileSystem.EncodingType.Base64 : FileSystem.EncodingType.UTF8,
|
|
19
|
+
});
|
|
41
20
|
return content;
|
|
42
21
|
} catch {
|
|
43
22
|
return null;
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
import React, { useEffect, useRef, memo } from 'react';
|
|
29
29
|
import {
|
|
30
30
|
View,
|
|
31
|
-
Text,
|
|
32
31
|
Animated,
|
|
33
32
|
StyleSheet,
|
|
34
33
|
type ViewStyle,
|
|
35
34
|
type TextStyle,
|
|
36
35
|
} from 'react-native';
|
|
36
|
+
import { AtomicText } from '../../../atoms';
|
|
37
37
|
|
|
38
38
|
export interface OfflineBannerProps {
|
|
39
39
|
/** Whether the banner is visible */
|
|
@@ -126,11 +126,11 @@ export const OfflineBanner: React.FC<OfflineBannerProps> = memo(({
|
|
|
126
126
|
>
|
|
127
127
|
<View style={styles.content}>
|
|
128
128
|
{typeof icon === 'string' ? (
|
|
129
|
-
<
|
|
129
|
+
<AtomicText style={styles.icon}>{icon}</AtomicText>
|
|
130
130
|
) : (
|
|
131
131
|
icon
|
|
132
132
|
)}
|
|
133
|
-
<
|
|
133
|
+
<AtomicText
|
|
134
134
|
style={[
|
|
135
135
|
styles.message,
|
|
136
136
|
{ color: textColor },
|
|
@@ -139,7 +139,7 @@ export const OfflineBanner: React.FC<OfflineBannerProps> = memo(({
|
|
|
139
139
|
numberOfLines={1}
|
|
140
140
|
>
|
|
141
141
|
{message}
|
|
142
|
-
</
|
|
142
|
+
</AtomicText>
|
|
143
143
|
</View>
|
|
144
144
|
</Animated.View>
|
|
145
145
|
);
|