@umituz/react-native-ai-generation-content 1.26.45 → 1.26.46

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.45",
3
+ "version": "1.26.46",
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",
@@ -4,7 +4,7 @@
4
4
  * NO feature-specific logic - works for ANY photo upload
5
5
  */
6
6
 
7
- import { useState, useCallback } from "react";
7
+ import { useState, useCallback, useEffect } from "react";
8
8
  import * as ImagePicker from "expo-image-picker";
9
9
  import { Alert } from "react-native";
10
10
  import type { UploadedImage } from "../../../../../presentation/hooks/generation/useAIGenerateState";
@@ -41,6 +41,12 @@ export const usePhotoUploadState = ({
41
41
  }: UsePhotoUploadStateProps): UsePhotoUploadStateReturn => {
42
42
  const [image, setImage] = useState<UploadedImage | null>(initialImage || null);
43
43
 
44
+ // Sync state with initialImage prop when it changes
45
+ // This handles cases where the same component is reused for different steps
46
+ useEffect(() => {
47
+ setImage(initialImage || null);
48
+ }, [initialImage]);
49
+
44
50
  const maxFileSizeMB = config?.maxFileSizeMB ?? DEFAULT_MAX_FILE_SIZE_MB;
45
51
 
46
52
  const handlePickImage = useCallback(async () => {
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Generic Generating Screen
3
3
  * Shows progress while AI generates content
4
- * Used by ALL features - NO feature-specific code!
4
+ * Uses scenario-specific messages with fallback to generic messages
5
5
  */
6
6
 
7
- import React from "react";
7
+ import React, { useMemo } from "react";
8
8
  import { View, StyleSheet, ActivityIndicator } from "react-native";
9
9
  import { useAppDesignTokens, AtomicText } from "@umituz/react-native-design-system";
10
10
 
@@ -13,6 +13,12 @@ export interface GeneratingScreenProps {
13
13
  readonly scenario?: {
14
14
  readonly id: string;
15
15
  readonly title?: string;
16
+ readonly category?: string;
17
+ readonly generatingMessages?: {
18
+ readonly title?: string;
19
+ readonly waitMessage?: string;
20
+ readonly hint?: string;
21
+ };
16
22
  };
17
23
  readonly t: (key: string) => string;
18
24
  readonly onCancel?: () => void;
@@ -33,17 +39,26 @@ export const GeneratingScreen: React.FC<GeneratingScreenProps> = ({
33
39
  });
34
40
  }
35
41
 
42
+ const messages = useMemo(() => {
43
+ const custom = scenario?.generatingMessages;
44
+ return {
45
+ title: custom?.title || t("generator.title"),
46
+ waitMessage: custom?.waitMessage || t("generator.waitMessage"),
47
+ hint: custom?.hint || t("generator.hint"),
48
+ };
49
+ }, [scenario, t]);
50
+
36
51
  return (
37
52
  <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
38
53
  <View style={styles.content}>
39
54
  <ActivityIndicator size="large" color={tokens.colors.primary} />
40
55
 
41
56
  <AtomicText type="headlineMedium" style={styles.title}>
42
- {t("generator.title")}
57
+ {messages.title}
43
58
  </AtomicText>
44
59
 
45
60
  <AtomicText type="bodyMedium" style={[styles.message, { color: tokens.colors.textSecondary }]}>
46
- {t("generator.waitMessage")}
61
+ {messages.waitMessage}
47
62
  </AtomicText>
48
63
 
49
64
  {/* Progress Bar */}
@@ -73,7 +88,7 @@ export const GeneratingScreen: React.FC<GeneratingScreenProps> = ({
73
88
 
74
89
  {/* Hint */}
75
90
  <AtomicText type="bodySmall" style={[styles.hint, { color: tokens.colors.textSecondary }]}>
76
- {t("generator.hint")}
91
+ {messages.hint}
77
92
  </AtomicText>
78
93
  </View>
79
94
  </View>
@@ -555,6 +555,12 @@ export enum ScenarioId {
555
555
 
556
556
  export type ScenarioOutputType = "image" | "video";
557
557
 
558
+ export interface GeneratingMessages {
559
+ title?: string;
560
+ waitMessage?: string;
561
+ hint?: string;
562
+ }
563
+
558
564
  export interface Scenario {
559
565
  id: ScenarioId;
560
566
  category?: ScenarioCategory;
@@ -570,4 +576,6 @@ export interface Scenario {
570
576
  outputType: ScenarioOutputType;
571
577
  model?: string; // AI model from app config
572
578
  enabled?: boolean;
579
+ // Optional custom generating screen messages
580
+ generatingMessages?: GeneratingMessages;
573
581
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  // Types
7
- export type { ScenarioOutputType } from "./domain/Scenario";
7
+ export type { ScenarioOutputType, GeneratingMessages } from "./domain/Scenario";
8
8
  export { ScenarioCategory, ScenarioId } from "./domain/Scenario";
9
9
  export type { Scenario } from "./domain/Scenario";
10
10