@umituz/react-native-ai-creations 1.2.0 → 1.2.2

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-creations",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "AI-generated creations gallery with filtering, sharing, and management for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -56,4 +56,4 @@
56
56
  "README.md",
57
57
  "LICENSE"
58
58
  ]
59
- }
59
+ }
@@ -3,9 +3,12 @@
3
3
  * Displays a single creation thumbnail
4
4
  */
5
5
 
6
- import React, { useMemo } from "react";
7
- import { Image, TouchableOpacity, StyleSheet } from "react-native";
8
- import { useAppDesignTokens } from "@umituz/react-native-design-system";
6
+ import React, { useMemo, useState } from "react";
7
+ import { Image, TouchableOpacity, StyleSheet, View } from "react-native";
8
+ import {
9
+ useAppDesignTokens,
10
+ AtomicIcon,
11
+ } from "@umituz/react-native-design-system";
9
12
 
10
13
  interface CreationThumbnailProps {
11
14
  readonly uri: string;
@@ -19,6 +22,7 @@ export function CreationThumbnail({
19
22
  onPress,
20
23
  }: CreationThumbnailProps) {
21
24
  const tokens = useAppDesignTokens();
25
+ const [isPressed, setIsPressed] = useState(false);
22
26
 
23
27
  const styles = useMemo(
24
28
  () =>
@@ -29,13 +33,31 @@ export function CreationThumbnail({
29
33
  borderRadius: tokens.spacing.sm,
30
34
  backgroundColor: tokens.colors.backgroundSecondary,
31
35
  },
36
+ overlay: {
37
+ ...StyleSheet.absoluteFillObject,
38
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
39
+ borderRadius: tokens.spacing.sm,
40
+ justifyContent: "center",
41
+ alignItems: "center",
42
+ },
32
43
  }),
33
- [tokens, size],
44
+ [tokens, size]
34
45
  );
35
46
 
36
47
  return (
37
- <TouchableOpacity onPress={onPress} disabled={!onPress}>
48
+ <TouchableOpacity
49
+ onPress={onPress}
50
+ disabled={!onPress}
51
+ onPressIn={() => setIsPressed(true)}
52
+ onPressOut={() => setIsPressed(false)}
53
+ activeOpacity={1}
54
+ >
38
55
  <Image source={{ uri }} style={styles.thumbnail} />
56
+ {isPressed && onPress && (
57
+ <View style={styles.overlay}>
58
+ <AtomicIcon name="eye" size="lg" color="textInverse" />
59
+ </View>
60
+ )}
39
61
  </TouchableOpacity>
40
62
  );
41
63
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * CreationsGalleryScreen
3
- * Full gallery view with filtering
3
+ * Full gallery view with filtering and editing
4
4
  */
5
5
 
6
6
  import React, { useMemo, useCallback, useState } from "react";
@@ -24,6 +24,8 @@ interface CreationsGalleryScreenProps {
24
24
  readonly repository: ICreationsRepository;
25
25
  readonly config: CreationsConfig;
26
26
  readonly t: (key: string) => string;
27
+ readonly enableEditing?: boolean;
28
+ readonly onImageEdit?: (uri: string, creationId: string) => void | Promise<void>;
27
29
  }
28
30
 
29
31
  export function CreationsGalleryScreen({
@@ -31,6 +33,8 @@ export function CreationsGalleryScreen({
31
33
  repository,
32
34
  config,
33
35
  t,
36
+ enableEditing = false,
37
+ onImageEdit,
34
38
  }: CreationsGalleryScreenProps) {
35
39
  const tokens = useAppDesignTokens();
36
40
  const insets = useSafeAreaInsets();
@@ -90,6 +94,16 @@ export function CreationsGalleryScreen({
90
94
  [t, config.translations, deleteMutation],
91
95
  );
92
96
 
97
+ const handleImageChange = useCallback(
98
+ async (uri: string, index: number) => {
99
+ const creation = filtered[index];
100
+ if (creation && onImageEdit) {
101
+ await onImageEdit(uri, creation.id);
102
+ }
103
+ },
104
+ [filtered, onImageEdit],
105
+ );
106
+
93
107
  const styles = useMemo(
94
108
  () =>
95
109
  StyleSheet.create({
@@ -165,6 +179,8 @@ export function CreationsGalleryScreen({
165
179
  index={viewerIndex}
166
180
  onDismiss={() => setViewerVisible(false)}
167
181
  onIndexChange={setViewerIndex}
182
+ enableEditing={enableEditing}
183
+ onImageChange={handleImageChange}
168
184
  />
169
185
  </View>
170
186
  );