@umituz/react-native-design-system 4.23.82 → 4.23.83
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 +1 -1
- package/src/layouts/Grid/Grid.tsx +16 -11
- package/src/media/infrastructure/utils/file-media-utils.ts +25 -8
- package/src/molecules/swipe-actions/presentation/components/SwipeActionButton.tsx +14 -1
- package/src/offline/presentation/hooks/useOffline.ts +2 -1
- package/src/storage/domain/utils/devUtils.ts +7 -6
- package/src/storage/infrastructure/adapters/StorageService.ts +0 -9
- package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.83",
|
|
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, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -78,17 +78,22 @@ export const Grid: React.FC<GridProps> = ({
|
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
80
|
<View style={[styles.container, style]} testID={testID}>
|
|
81
|
-
{childArray.map((child, index) =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
{childArray.map((child, index) => {
|
|
82
|
+
// Use child's key if available, otherwise use index
|
|
83
|
+
const key = (child as React.ReactElement).key || `grid-item-${index}`;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<View
|
|
87
|
+
key={key}
|
|
88
|
+
style={{
|
|
89
|
+
flex: columns ? 1 / columns - 0.01 : undefined,
|
|
90
|
+
minWidth: columns ? `${100 / columns - 1}%` : undefined,
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
{child}
|
|
94
|
+
</View>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
92
97
|
</View>
|
|
93
98
|
);
|
|
94
99
|
};
|
|
@@ -74,16 +74,33 @@ export const downloadMediaToFile = async (url: string, isVideo: boolean): Promis
|
|
|
74
74
|
const filename = `media_${timestamp}.${extension}`;
|
|
75
75
|
const file = new ExpoFile(Paths.cache, filename);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
77
|
+
// Create abort controller for timeout
|
|
78
|
+
const controller = new AbortController();
|
|
79
|
+
const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
try {
|
|
82
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
83
|
+
clearTimeout(timeoutId);
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
throw new Error(`Failed to download media: ${response.statusText}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
90
|
+
const bytes = new Uint8Array(arrayBuffer);
|
|
91
|
+
file.write(bytes);
|
|
92
|
+
|
|
93
|
+
return file.uri;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
// Clear timeout if error occurs
|
|
96
|
+
clearTimeout(timeoutId);
|
|
97
|
+
|
|
98
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
99
|
+
throw new Error('Download timeout - request took longer than 30 seconds');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
87
104
|
};
|
|
88
105
|
|
|
89
106
|
export interface SaveToGalleryResult {
|
|
@@ -65,7 +65,20 @@ export const SwipeActionButton: React.FC<SwipeActionButtonProps> = ({
|
|
|
65
65
|
const enableHaptics = action.enableHaptics !== false;
|
|
66
66
|
|
|
67
67
|
// Get background color from theme or custom
|
|
68
|
-
|
|
68
|
+
// Type-safe color lookup with fallback
|
|
69
|
+
const getBackgroundColor = (): string => {
|
|
70
|
+
if (customColor) {
|
|
71
|
+
return customColor;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (colorKey && colorKey in tokens.colors) {
|
|
75
|
+
return tokens.colors[colorKey as keyof typeof tokens.colors];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return tokens.colors.primary;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const backgroundColor = getBackgroundColor();
|
|
69
82
|
|
|
70
83
|
const handlePress = async () => {
|
|
71
84
|
// Trigger haptic feedback
|
|
@@ -56,7 +56,7 @@ export const useOffline = (config?: OfflineConfig) => {
|
|
|
56
56
|
|
|
57
57
|
networkEvents.emit('change', networkState);
|
|
58
58
|
previousStateRef.current = networkState;
|
|
59
|
-
}, [store]);
|
|
59
|
+
}, [store, previousStateRef]);
|
|
60
60
|
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
if (isInitialized.current) return;
|
|
@@ -72,6 +72,7 @@ export const useOffline = (config?: OfflineConfig) => {
|
|
|
72
72
|
})
|
|
73
73
|
.catch((_error: Error) => {
|
|
74
74
|
if (isMountedRef.current && (__DEV__ || mergedConfig.debug)) {
|
|
75
|
+
console.error('[DesignSystem] useOffline: Failed to get initial network state', _error);
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
|
|
@@ -11,24 +11,25 @@ export const isDev = (): boolean => {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Log warning in development mode only
|
|
14
|
+
* All logs are disabled
|
|
14
15
|
*/
|
|
15
16
|
export const devWarn = (_message: string, ..._args: unknown[]): void => {
|
|
16
|
-
|
|
17
|
-
}
|
|
17
|
+
// Disabled
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Log error in development mode only
|
|
22
|
+
* All logs are disabled
|
|
22
23
|
*/
|
|
23
24
|
export const devError = (_message: string, ..._args: unknown[]): void => {
|
|
24
|
-
|
|
25
|
-
}
|
|
25
|
+
// Disabled
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Log info in development mode only
|
|
30
|
+
* All logs are disabled
|
|
30
31
|
*/
|
|
31
32
|
export const devLog = (_message: string, ..._args: unknown[]): void => {
|
|
32
|
-
|
|
33
|
-
}
|
|
33
|
+
// Disabled
|
|
34
34
|
};
|
|
35
|
+
|
|
@@ -20,9 +20,6 @@ export const storageService: StateStorage = {
|
|
|
20
20
|
} catch (error) {
|
|
21
21
|
const errorMessage = `StorageService: Failed to get item "${name}"`;
|
|
22
22
|
devWarn(errorMessage, error);
|
|
23
|
-
// Also log in production for debugging
|
|
24
|
-
if (!__DEV__) {
|
|
25
|
-
}
|
|
26
23
|
return null;
|
|
27
24
|
}
|
|
28
25
|
},
|
|
@@ -33,9 +30,6 @@ export const storageService: StateStorage = {
|
|
|
33
30
|
} catch (error) {
|
|
34
31
|
const errorMessage = `StorageService: Failed to set item "${name}"`;
|
|
35
32
|
devWarn(errorMessage, error);
|
|
36
|
-
// Also log in production for debugging
|
|
37
|
-
if (!__DEV__) {
|
|
38
|
-
}
|
|
39
33
|
}
|
|
40
34
|
},
|
|
41
35
|
|
|
@@ -45,9 +39,6 @@ export const storageService: StateStorage = {
|
|
|
45
39
|
} catch (error) {
|
|
46
40
|
const errorMessage = `StorageService: Failed to remove item "${name}"`;
|
|
47
41
|
devWarn(errorMessage, error);
|
|
48
|
-
// Also log in production for debugging
|
|
49
|
-
if (!__DEV__) {
|
|
50
|
-
}
|
|
51
42
|
}
|
|
52
43
|
},
|
|
53
44
|
};
|
|
@@ -83,9 +83,6 @@ export class BaseStorageOperations {
|
|
|
83
83
|
} catch (error) {
|
|
84
84
|
const errorMessage = `BaseStorageOperations: Failed to check if key "${key}" exists`;
|
|
85
85
|
devWarn(errorMessage, error);
|
|
86
|
-
// Also log in production for debugging
|
|
87
|
-
if (!__DEV__) {
|
|
88
|
-
}
|
|
89
86
|
return false;
|
|
90
87
|
}
|
|
91
88
|
}
|