@umituz/react-native-ai-generation-content 1.17.118 → 1.17.120
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,26 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, StyleSheet, useWindowDimensions } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, useWindowDimensions, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
4
4
|
import { Image } from 'expo-image';
|
|
5
5
|
|
|
6
6
|
interface DetailImageProps {
|
|
7
7
|
readonly uri: string;
|
|
8
|
+
readonly onPress?: () => void;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
const HORIZONTAL_PADDING = 16;
|
|
11
12
|
const ASPECT_RATIO = 16 / 9;
|
|
12
13
|
|
|
13
|
-
export const DetailImage: React.FC<DetailImageProps> = ({ uri }) => {
|
|
14
|
+
export const DetailImage: React.FC<DetailImageProps> = ({ uri, onPress }) => {
|
|
14
15
|
const tokens = useAppDesignTokens();
|
|
15
16
|
const { width } = useWindowDimensions();
|
|
16
17
|
const imageWidth = width - (HORIZONTAL_PADDING * 2);
|
|
17
18
|
const imageHeight = imageWidth / ASPECT_RATIO;
|
|
18
19
|
|
|
20
|
+
const content = (
|
|
21
|
+
<View style={[styles.frame, { width: imageWidth, height: imageHeight, backgroundColor: tokens.colors.surface }]}>
|
|
22
|
+
<Image source={{ uri }} style={styles.image} contentFit="cover" />
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
|
|
19
26
|
return (
|
|
20
27
|
<View style={styles.container}>
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
28
|
+
{onPress ? (
|
|
29
|
+
<TouchableOpacity activeOpacity={0.9} onPress={onPress}>
|
|
30
|
+
{content}
|
|
31
|
+
</TouchableOpacity>
|
|
32
|
+
) : (
|
|
33
|
+
content
|
|
34
|
+
)}
|
|
24
35
|
</View>
|
|
25
36
|
);
|
|
26
37
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useMemo, useState, useCallback } from 'react';
|
|
2
2
|
import { View, ScrollView, StyleSheet } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
5
|
+
import { ImageGallery } from "@umituz/react-native-image";
|
|
5
6
|
import type { Creation } from '../../domain/entities/Creation';
|
|
6
7
|
import type { CreationsConfig } from '../../domain/value-objects/CreationsConfig';
|
|
7
8
|
import { hasVideoContent, getPreviewUrl } from '../../domain/utils';
|
|
@@ -41,6 +42,15 @@ export const CreationDetailScreen: React.FC<CreationDetailScreenProps> = ({
|
|
|
41
42
|
}) => {
|
|
42
43
|
const tokens = useAppDesignTokens();
|
|
43
44
|
const insets = useSafeAreaInsets();
|
|
45
|
+
const [showFullScreen, setShowFullScreen] = useState(false);
|
|
46
|
+
|
|
47
|
+
const handleImagePress = useCallback(() => {
|
|
48
|
+
setShowFullScreen(true);
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
const handleDismissFullScreen = useCallback(() => {
|
|
52
|
+
setShowFullScreen(false);
|
|
53
|
+
}, []);
|
|
44
54
|
|
|
45
55
|
// Extract data safely
|
|
46
56
|
const metadata = (creation.metadata || {}) as CreationMetadata;
|
|
@@ -81,7 +91,7 @@ export const CreationDetailScreen: React.FC<CreationDetailScreenProps> = ({
|
|
|
81
91
|
{isVideo ? (
|
|
82
92
|
<DetailVideo videoUrl={videoUrl} thumbnailUrl={thumbnailUrl} />
|
|
83
93
|
) : (
|
|
84
|
-
<DetailImage uri={creation.uri} />
|
|
94
|
+
<DetailImage uri={creation.uri} onPress={handleImagePress} />
|
|
85
95
|
)}
|
|
86
96
|
|
|
87
97
|
{story ? (
|
|
@@ -95,6 +105,15 @@ export const CreationDetailScreen: React.FC<CreationDetailScreenProps> = ({
|
|
|
95
105
|
deleteLabel={t("common.delete")}
|
|
96
106
|
/>
|
|
97
107
|
</ScrollView>
|
|
108
|
+
|
|
109
|
+
{!isVideo && (
|
|
110
|
+
<ImageGallery
|
|
111
|
+
images={[{ uri: creation.uri }]}
|
|
112
|
+
visible={showFullScreen}
|
|
113
|
+
onDismiss={handleDismissFullScreen}
|
|
114
|
+
index={0}
|
|
115
|
+
/>
|
|
116
|
+
)}
|
|
98
117
|
</View>
|
|
99
118
|
);
|
|
100
119
|
};
|
|
@@ -226,7 +226,7 @@ export function useTextToVideoFeature(
|
|
|
226
226
|
return { success: false, error: errorMessage };
|
|
227
227
|
}
|
|
228
228
|
},
|
|
229
|
-
[userId, config.model, buildInput, extractResult, callbacks],
|
|
229
|
+
[userId, config.model, config.creditCost, buildInput, extractResult, callbacks],
|
|
230
230
|
);
|
|
231
231
|
|
|
232
232
|
const reset = useCallback(() => {
|