@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
|
@@ -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
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
}
|