@umituz/react-native-ai-generation-content 1.17.291 → 1.17.293
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-ai-generation-content",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.293",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@types/react": "~19.1.10",
|
|
63
63
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
64
64
|
"@typescript-eslint/parser": "^8.0.0",
|
|
65
|
-
"@umituz/react-native-design-system": "
|
|
65
|
+
"@umituz/react-native-design-system": "*",
|
|
66
66
|
"@umituz/react-native-firebase": "*",
|
|
67
67
|
"@umituz/react-native-localization": "*",
|
|
68
68
|
"eslint": "^9.0.0",
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CreationImagePreview Component
|
|
3
3
|
* Displays image preview with loading/placeholder states
|
|
4
|
+
* Uses expo-image for caching and performance
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
|
-
import React, { useMemo, useState } from "react";
|
|
7
|
-
import {
|
|
8
|
-
View,
|
|
9
|
-
StyleSheet,
|
|
10
|
-
Image,
|
|
11
|
-
type ImageErrorEventData,
|
|
12
|
-
type NativeSyntheticEvent,
|
|
13
|
-
} from "react-native";
|
|
7
|
+
import React, { useMemo, useState, useCallback } from "react";
|
|
8
|
+
import { View, StyleSheet } from "react-native";
|
|
14
9
|
import {
|
|
15
10
|
useAppDesignTokens,
|
|
16
11
|
AtomicIcon,
|
|
17
12
|
AtomicSpinner,
|
|
13
|
+
AtomicImage,
|
|
18
14
|
} from "@umituz/react-native-design-system";
|
|
19
15
|
import type { CreationStatus, CreationTypeId } from "../../domain/types";
|
|
20
16
|
import { isInProgress, getTypeIcon } from "../../domain/utils";
|
|
@@ -46,12 +42,18 @@ export function CreationImagePreview({
|
|
|
46
42
|
const inProgress = isInProgress(status);
|
|
47
43
|
const typeIcon = getTypeIcon(type);
|
|
48
44
|
const [imageError, setImageError] = useState(false);
|
|
45
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
49
46
|
|
|
50
47
|
const hasPreview = !!uri && !inProgress && !imageError;
|
|
51
48
|
|
|
52
|
-
const handleImageError = (
|
|
49
|
+
const handleImageError = useCallback(() => {
|
|
53
50
|
setImageError(true);
|
|
54
|
-
|
|
51
|
+
setIsLoading(false);
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
const handleLoadEnd = useCallback(() => {
|
|
55
|
+
setIsLoading(false);
|
|
56
|
+
}, []);
|
|
55
57
|
|
|
56
58
|
const styles = useMemo(
|
|
57
59
|
() =>
|
|
@@ -74,11 +76,11 @@ export function CreationImagePreview({
|
|
|
74
76
|
justifyContent: "center",
|
|
75
77
|
alignItems: "center",
|
|
76
78
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
height: "100%",
|
|
79
|
+
loadingOverlay: {
|
|
80
|
+
...StyleSheet.absoluteFillObject,
|
|
80
81
|
justifyContent: "center",
|
|
81
82
|
alignItems: "center",
|
|
83
|
+
backgroundColor: tokens.colors.backgroundSecondary,
|
|
82
84
|
},
|
|
83
85
|
loadingIcon: {
|
|
84
86
|
width: 64,
|
|
@@ -92,11 +94,11 @@ export function CreationImagePreview({
|
|
|
92
94
|
[tokens, aspectRatio, height]
|
|
93
95
|
);
|
|
94
96
|
|
|
95
|
-
// Show loading state
|
|
97
|
+
// Show loading state during generation
|
|
96
98
|
if (inProgress && showLoadingIndicator) {
|
|
97
99
|
return (
|
|
98
100
|
<View style={styles.container}>
|
|
99
|
-
<View style={styles.
|
|
101
|
+
<View style={styles.loadingOverlay}>
|
|
100
102
|
<View style={styles.loadingIcon}>
|
|
101
103
|
<AtomicSpinner size="lg" color="primary" />
|
|
102
104
|
</View>
|
|
@@ -105,16 +107,26 @@ export function CreationImagePreview({
|
|
|
105
107
|
);
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
// Show image preview
|
|
110
|
+
// Show image preview with caching
|
|
109
111
|
if (hasPreview) {
|
|
110
112
|
return (
|
|
111
113
|
<View style={styles.container}>
|
|
112
|
-
<
|
|
114
|
+
<AtomicImage
|
|
113
115
|
source={{ uri }}
|
|
114
116
|
style={styles.image}
|
|
115
|
-
|
|
117
|
+
contentFit="cover"
|
|
118
|
+
transition={200}
|
|
119
|
+
cachePolicy="disk"
|
|
116
120
|
onError={handleImageError}
|
|
121
|
+
onLoadEnd={handleLoadEnd}
|
|
122
|
+
placeholder={{ blurhash: "L6PZfSi_.AyE_3t7t7R**0o#DgR4" }}
|
|
123
|
+
placeholderContentFit="cover"
|
|
117
124
|
/>
|
|
125
|
+
{isLoading && (
|
|
126
|
+
<View style={styles.loadingOverlay}>
|
|
127
|
+
<AtomicSpinner size="md" color="primary" />
|
|
128
|
+
</View>
|
|
129
|
+
)}
|
|
118
130
|
</View>
|
|
119
131
|
);
|
|
120
132
|
}
|