@umituz/react-native-ai-generation-content 1.12.15 → 1.12.16
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,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
2
4
|
import { ImageGallery } from "@umituz/react-native-image";
|
|
5
|
+
import { AtomicIcon, AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
3
6
|
import type { Creation } from "../../domain/entities/Creation";
|
|
4
7
|
|
|
5
8
|
interface CreationImageViewerProps {
|
|
@@ -23,12 +26,66 @@ export const CreationImageViewer: React.FC<CreationImageViewerProps> = ({
|
|
|
23
26
|
onImageEdit,
|
|
24
27
|
selectedCreationId,
|
|
25
28
|
}) => {
|
|
29
|
+
const tokens = useAppDesignTokens();
|
|
30
|
+
const insets = useSafeAreaInsets();
|
|
31
|
+
|
|
26
32
|
const handleImageChange = async (uri: string) => {
|
|
27
33
|
if (selectedCreationId && onImageEdit) {
|
|
28
34
|
await onImageEdit(uri, selectedCreationId);
|
|
29
35
|
}
|
|
30
36
|
};
|
|
31
37
|
|
|
38
|
+
const HeaderComponent = ({ imageIndex }: { imageIndex: number }) => (
|
|
39
|
+
<View style={[styles.header, { paddingTop: Math.max(insets.top, tokens.spacing.sm) }]} pointerEvents="box-none">
|
|
40
|
+
<View style={styles.counter}>
|
|
41
|
+
<AtomicText style={styles.counterText}>
|
|
42
|
+
{imageIndex + 1} / {creations.length}
|
|
43
|
+
</AtomicText>
|
|
44
|
+
</View>
|
|
45
|
+
<TouchableOpacity
|
|
46
|
+
onPress={onDismiss}
|
|
47
|
+
style={styles.closeButton}
|
|
48
|
+
activeOpacity={0.7}
|
|
49
|
+
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
50
|
+
>
|
|
51
|
+
<AtomicIcon name="close" size="lg" color="white" />
|
|
52
|
+
</TouchableOpacity>
|
|
53
|
+
</View>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
header: {
|
|
58
|
+
position: 'absolute',
|
|
59
|
+
top: 0,
|
|
60
|
+
left: 0,
|
|
61
|
+
right: 0,
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
justifyContent: 'space-between',
|
|
64
|
+
paddingHorizontal: tokens.spacing.lg,
|
|
65
|
+
zIndex: 999,
|
|
66
|
+
},
|
|
67
|
+
counter: {
|
|
68
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
69
|
+
paddingHorizontal: tokens.spacing.md,
|
|
70
|
+
paddingVertical: tokens.spacing.xs,
|
|
71
|
+
borderRadius: tokens.spacing.pill || 20,
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
},
|
|
74
|
+
counterText: {
|
|
75
|
+
...tokens.typography.bodyMedium,
|
|
76
|
+
color: '#FFFFFF',
|
|
77
|
+
fontWeight: '600',
|
|
78
|
+
},
|
|
79
|
+
closeButton: {
|
|
80
|
+
width: 40,
|
|
81
|
+
height: 40,
|
|
82
|
+
borderRadius: 20,
|
|
83
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
32
89
|
return (
|
|
33
90
|
<ImageGallery
|
|
34
91
|
images={creations.map((c) => ({ uri: c.uri }))}
|
|
@@ -36,6 +93,7 @@ export const CreationImageViewer: React.FC<CreationImageViewerProps> = ({
|
|
|
36
93
|
index={index}
|
|
37
94
|
onDismiss={onDismiss}
|
|
38
95
|
onIndexChange={onIndexChange}
|
|
96
|
+
HeaderComponent={HeaderComponent}
|
|
39
97
|
{...(enableEditing && { enableEditing } as any)}
|
|
40
98
|
{...(onImageEdit && { onImageChange: handleImageChange } as any)}
|
|
41
99
|
/>
|