@umituz/react-native-ai-creations 1.3.9 → 1.3.11

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.3.9",
3
+ "version": "1.3.11",
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",
@@ -22,14 +22,15 @@ interface FilterBottomSheetProps {
22
22
  onFilterPress: (id: string, categoryId: string) => void;
23
23
  onClearFilters: () => void;
24
24
  title: string;
25
+ snapPoints?: string[];
25
26
  }
26
27
 
27
28
  export const FilterBottomSheet = forwardRef<BottomSheetModalRef, FilterBottomSheetProps>((props, ref) => {
28
- const { categories, selectedIds, onFilterPress, onClearFilters, title } = props;
29
+ const { categories, selectedIds, onFilterPress, onClearFilters, title, snapPoints: propSnapPoints } = props;
29
30
  const tokens = useAppDesignTokens();
30
31
  const styles = useStyles(tokens);
31
32
 
32
- const snapPoints = useMemo(() => ['50%', '75%'], []);
33
+ const snapPoints = useMemo(() => propSnapPoints || ['50%', '75%'], [propSnapPoints]);
33
34
 
34
35
  const renderOption = useCallback((option: FilterOption, category: FilterCategory) => {
35
36
  const isSelected = selectedIds.includes(option.id);
@@ -115,18 +115,7 @@ export function CreationsGalleryScreen({
115
115
 
116
116
  const styles = useStyles(tokens);
117
117
 
118
- if (!isLoading && (!creations || creations.length === 0)) {
119
- return (
120
- <View style={styles.container}>
121
- <EmptyState
122
- title={t(config.translations.empty)}
123
- description={t(config.translations.emptyDescription)}
124
- actionLabel={emptyActionLabel}
125
- onAction={onEmptyAction}
126
- />
127
- </View>
128
- );
129
- }
118
+ const showEmptyState = !isLoading && (!creations || creations.length === 0);
130
119
 
131
120
  return (
132
121
  <View style={styles.container}>
@@ -139,37 +128,49 @@ export function CreationsGalleryScreen({
139
128
  onFilterPress={() => filterSheetRef.current?.present()}
140
129
  style={{ paddingTop: insets.top + tokens.spacing.md }}
141
130
  />
142
- <CreationsGrid
143
- creations={filtered}
144
- types={translatedTypes}
145
- isLoading={isLoading}
146
- onRefresh={refetch}
147
- onView={setSelectedCreation}
148
- onShare={handleShare}
149
- onDelete={handleDelete}
150
- contentContainerStyle={{ paddingBottom: insets.bottom + tokens.spacing.xl }}
151
- />
152
- <ImageGallery
153
- images={filtered.map(c => ({ uri: c.uri }))}
154
- visible={viewerVisible}
155
- index={viewerIndex}
156
- onDismiss={() => setViewerVisible(false)}
157
- onIndexChange={setViewerIndex}
158
- {...(enableEditing && { enableEditing } as any)}
159
- {...(onImageEdit && {
160
- onImageChange: async (uri: string) => {
161
- if (selectedCreation) { await onImageEdit(uri, (selectedCreation as Creation).id); refetch(); }
162
- }
163
- } as any)}
164
- />
165
- <FilterBottomSheet
166
- ref={filterSheetRef}
167
- categories={allCategories}
168
- selectedIds={selectedIds}
169
- onFilterPress={(id, catId) => toggleFilter(id, allCategories.find(c => c.id === catId)?.multiSelect)}
170
- onClearFilters={clearFilters}
171
- title={t(config.translations.filterTitle) || t("common.filter")}
172
- />
131
+
132
+ {showEmptyState ? (
133
+ <EmptyState
134
+ title={t(config.translations.empty)}
135
+ description={t(config.translations.emptyDescription)}
136
+ actionLabel={emptyActionLabel}
137
+ onAction={onEmptyAction}
138
+ />
139
+ ) : (
140
+ <>
141
+ <CreationsGrid
142
+ creations={filtered}
143
+ types={translatedTypes}
144
+ isLoading={isLoading}
145
+ onRefresh={refetch}
146
+ onView={setSelectedCreation}
147
+ onShare={handleShare}
148
+ onDelete={handleDelete}
149
+ contentContainerStyle={{ paddingBottom: insets.bottom + tokens.spacing.xl }}
150
+ />
151
+ <ImageGallery
152
+ images={filtered.map(c => ({ uri: c.uri }))}
153
+ visible={viewerVisible}
154
+ index={viewerIndex}
155
+ onDismiss={() => setViewerVisible(false)}
156
+ onIndexChange={setViewerIndex}
157
+ {...(enableEditing && { enableEditing } as any)}
158
+ {...(onImageEdit && {
159
+ onImageChange: async (uri: string) => {
160
+ if (selectedCreation) { await onImageEdit(uri, (selectedCreation as Creation).id); refetch(); }
161
+ }
162
+ } as any)}
163
+ />
164
+ <FilterBottomSheet
165
+ ref={filterSheetRef}
166
+ categories={allCategories}
167
+ selectedIds={selectedIds}
168
+ onFilterPress={(id, catId) => toggleFilter(id, allCategories.find(c => c.id === catId)?.multiSelect)}
169
+ onClearFilters={clearFilters}
170
+ title={t(config.translations.filterTitle) || t("common.filter")}
171
+ />
172
+ </>
173
+ )}
173
174
  </View>
174
175
  );
175
176
  }