@umituz/react-native-ai-creations 1.3.13 → 1.4.1

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.13",
3
+ "version": "1.4.1",
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",
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo, useCallback, useState } from "react";
2
- import { View, StyleSheet } from "react-native";
2
+ import { View, StyleSheet, ActivityIndicator } from "react-native";
3
3
  import { useAppDesignTokens } from "@umituz/react-native-design-system";
4
4
  import { useSharing } from "@umituz/react-native-sharing";
5
5
  import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -83,6 +83,11 @@ export function CreationsGalleryScreen({
83
83
  });
84
84
  }, [alert, config, deleteMutation, t]);
85
85
 
86
+ // Handle viewing a creation - shows detail screen
87
+ const handleView = useCallback((creation: Creation) => {
88
+ setSelectedCreation(creation);
89
+ }, []);
90
+
86
91
  if (selectedCreation) {
87
92
  return (
88
93
  <CreationDetailScreen
@@ -97,8 +102,32 @@ export function CreationsGalleryScreen({
97
102
 
98
103
  const styles = useStyles(tokens);
99
104
 
100
- const showEmptyState = !isLoading && (!creations || creations.length === 0);
105
+ // 1. Loading State - Prevent header flash
106
+ if (isLoading && (!creations || creations.length === 0)) {
107
+ return (
108
+ <View style={[styles.container, styles.center]}>
109
+ <ActivityIndicator size="large" color={tokens.colors.primary} />
110
+ </View>
111
+ );
112
+ }
113
+
114
+ // 2. Pure Empty State - If no creations exist at all, don't show filters
115
+ if (!creations || creations.length === 0) {
116
+ return (
117
+ <View style={styles.container}>
118
+ <View style={[styles.container, { paddingTop: insets.top + tokens.spacing.md }]}>
119
+ <EmptyState
120
+ title={t(config.translations.empty)}
121
+ description={t(config.translations.emptyDescription)}
122
+ actionLabel={emptyActionLabel}
123
+ onAction={onEmptyAction}
124
+ />
125
+ </View>
126
+ </View>
127
+ );
128
+ }
101
129
 
130
+ // 3. Gallery Content
102
131
  return (
103
132
  <View style={styles.container}>
104
133
  <GalleryHeader
@@ -111,12 +140,12 @@ export function CreationsGalleryScreen({
111
140
  style={{ paddingTop: insets.top + tokens.spacing.md }}
112
141
  />
113
142
 
114
- {showEmptyState ? (
143
+ {filtered.length === 0 ? (
115
144
  <EmptyState
116
- title={t(config.translations.empty)}
117
- description={t(config.translations.emptyDescription)}
118
- actionLabel={emptyActionLabel}
119
- onAction={onEmptyAction}
145
+ title={t("common.no_results") || "No results"}
146
+ description={t("common.no_results_description") || "Try changing your filters"}
147
+ actionLabel={t("common.clear_all") || "Clear All"}
148
+ onAction={clearFilters}
120
149
  />
121
150
  ) : (
122
151
  <>
@@ -125,7 +154,7 @@ export function CreationsGalleryScreen({
125
154
  types={translatedTypes}
126
155
  isLoading={isLoading}
127
156
  onRefresh={refetch}
128
- onView={setSelectedCreation}
157
+ onView={handleView}
129
158
  onShare={handleShare}
130
159
  onDelete={handleDelete}
131
160
  contentContainerStyle={{ paddingBottom: insets.bottom + tokens.spacing.xl }}
@@ -138,24 +167,23 @@ export function CreationsGalleryScreen({
138
167
  onIndexChange={setViewerIndex}
139
168
  enableEditing={enableEditing}
140
169
  onImageEdit={onImageEdit}
141
- selectedCreationId={selectedCreation?.id}
142
- />
143
- <FilterBottomSheet
144
- ref={filterSheetRef}
145
- categories={allCategories}
146
- selectedIds={selectedIds}
147
- onFilterPress={(id, catId) => toggleFilter(id, allCategories.find(c => c.id === catId)?.multiSelect)}
148
- onClearFilters={clearFilters}
149
- title={t(config.translations.filterTitle) || t("common.filter")}
150
170
  />
151
171
  </>
152
172
  )}
173
+
174
+ <FilterBottomSheet
175
+ ref={filterSheetRef}
176
+ categories={allCategories}
177
+ selectedIds={selectedIds}
178
+ onFilterPress={(id, catId) => toggleFilter(id, allCategories.find(c => c.id === catId)?.multiSelect)}
179
+ onClearFilters={clearFilters}
180
+ title={t(config.translations.filterTitle) || t("common.filter")}
181
+ />
153
182
  </View>
154
183
  );
155
184
  }
156
185
 
157
-
158
-
159
186
  const useStyles = (tokens: any) => StyleSheet.create({
160
187
  container: { flex: 1, backgroundColor: tokens.colors.background },
188
+ center: { justifyContent: 'center', alignItems: 'center' },
161
189
  });