@umituz/react-native-ai-generation-content 1.26.11 → 1.26.12

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-generation-content",
3
- "version": "1.26.11",
3
+ "version": "1.26.12",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -22,10 +22,13 @@ export interface CategoryNavigationContainerProps {
22
22
  readonly scenarios: readonly ScenarioData[];
23
23
  readonly onSelectScenario: (scenarioId: string) => void;
24
24
  readonly onBack?: () => void;
25
+ readonly onSelectMainCategory?: (categoryId: string) => void;
26
+ readonly onSelectSubCategory?: (subCategoryId: string) => void;
25
27
  readonly t: (key: string) => string;
26
28
  readonly headerTitle?: string;
27
29
  readonly headerDescription?: string;
28
30
  readonly numColumns?: number;
31
+ readonly isLoading?: boolean;
29
32
  }
30
33
 
31
34
  export const CategoryNavigationContainer: React.FC<
@@ -36,10 +39,13 @@ export const CategoryNavigationContainer: React.FC<
36
39
  scenarios,
37
40
  onSelectScenario,
38
41
  onBack,
42
+ onSelectMainCategory,
43
+ onSelectSubCategory,
39
44
  t,
40
45
  headerTitle,
41
46
  headerDescription,
42
47
  numColumns = 2,
48
+ isLoading = false,
43
49
  }) => {
44
50
  const [currentStep, setCurrentStep] = useState<NavigationStep>("main_category");
45
51
  const [selectedMainCategoryId, setSelectedMainCategoryId] = useState<string | null>(null);
@@ -76,7 +82,10 @@ export const CategoryNavigationContainer: React.FC<
76
82
  }
77
83
  setSelectedMainCategoryId(categoryId);
78
84
  setCurrentStep("sub_category");
79
- }, []);
85
+ if (onSelectMainCategory) {
86
+ onSelectMainCategory(categoryId);
87
+ }
88
+ }, [onSelectMainCategory]);
80
89
 
81
90
  const handleSelectSubCategory = useCallback((subCategoryId: string) => {
82
91
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -86,7 +95,10 @@ export const CategoryNavigationContainer: React.FC<
86
95
  }
87
96
  setSelectedSubCategoryId(subCategoryId);
88
97
  setCurrentStep("scenario_list");
89
- }, []);
98
+ if (onSelectSubCategory) {
99
+ onSelectSubCategory(subCategoryId);
100
+ }
101
+ }, [onSelectSubCategory]);
90
102
 
91
103
  const handleBackFromSubCategory = useCallback(() => {
92
104
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -162,6 +174,7 @@ export const CategoryNavigationContainer: React.FC<
162
174
  onBack={handleBackFromScenarioList}
163
175
  t={t}
164
176
  numColumns={numColumns}
177
+ isLoading={isLoading}
165
178
  />
166
179
  );
167
180
  }
@@ -20,6 +20,7 @@ import {
20
20
  ScreenLayout,
21
21
  NavigationHeader,
22
22
  AtomicIcon,
23
+ AtomicSpinner,
23
24
  type DesignTokens,
24
25
  } from "@umituz/react-native-design-system";
25
26
  import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -33,6 +34,7 @@ export interface HierarchicalScenarioListScreenProps {
33
34
  readonly onBack: () => void;
34
35
  readonly t: (key: string) => string;
35
36
  readonly numColumns?: number;
37
+ readonly isLoading?: boolean;
36
38
  }
37
39
 
38
40
  export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListScreenProps> = ({
@@ -43,6 +45,7 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
43
45
  onBack,
44
46
  t,
45
47
  numColumns = 2,
48
+ isLoading = false,
46
49
  }) => {
47
50
  const tokens = useAppDesignTokens();
48
51
  const insets = useSafeAreaInsets();
@@ -68,7 +71,7 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
68
71
 
69
72
  const filtered = scenarios.filter((scenario) => {
70
73
  if (!scenario.category) return false;
71
- return subCategory.scenarioCategories.includes(scenario.category);
74
+ return subCategory.scenarioCategories?.includes(scenario.category) ?? false;
72
75
  });
73
76
 
74
77
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -152,6 +155,18 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
152
155
  ),
153
156
  [t, styles.emptyState]
154
157
  );
158
+
159
+ const LoadingComponent = useMemo(
160
+ () => (
161
+ <View style={styles.loadingContainer}>
162
+ <AtomicSpinner size="lg" color="primary" />
163
+ <AtomicText type="bodyMedium" style={{ marginTop: tokens.spacing.md }}>
164
+ {t("common.loading")}
165
+ </AtomicText>
166
+ </View>
167
+ ),
168
+ [tokens, t, styles.loadingContainer]
169
+ );
155
170
 
156
171
  if (!subCategory) {
157
172
  return null;
@@ -213,7 +228,9 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
213
228
  renderItem={renderItem}
214
229
  keyExtractor={(item) => item.id}
215
230
  ListEmptyComponent={
216
- filteredScenarios.length === 0 ? ListEmptyComponent : null
231
+ isLoading
232
+ ? LoadingComponent
233
+ : (filteredScenarios.length === 0 ? ListEmptyComponent : null)
217
234
  }
218
235
  contentContainerStyle={[
219
236
  styles.listContent,
@@ -254,6 +271,12 @@ const createStyles = (
254
271
  alignItems: "center",
255
272
  paddingVertical: tokens.spacing.xl,
256
273
  },
274
+ loadingContainer: {
275
+ flex: 1,
276
+ justifyContent: "center",
277
+ alignItems: "center",
278
+ paddingVertical: tokens.spacing.xl,
279
+ },
257
280
  continueButton: {
258
281
  flexDirection: "row",
259
282
  alignItems: "center",