@umituz/react-native-ai-generation-content 1.17.89 → 1.17.91
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,10 +1,12 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
2
|
import { TouchableOpacity, StyleSheet } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
AtomicText,
|
|
5
5
|
AtomicIcon,
|
|
6
6
|
useAppDesignTokens,
|
|
7
7
|
} from "@umituz/react-native-design-system";
|
|
8
|
+
|
|
9
|
+
declare const __DEV__: boolean;
|
|
8
10
|
import { StyleSelector } from "./selectors/StyleSelector";
|
|
9
11
|
import { DurationSelector } from "./selectors/DurationSelector";
|
|
10
12
|
import { AspectRatioSelector } from "./selectors/AspectRatioSelector";
|
|
@@ -44,6 +46,13 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
|
|
|
44
46
|
}) => {
|
|
45
47
|
const tokens = useAppDesignTokens();
|
|
46
48
|
const isAdvancedVisible = showAdvanced !== undefined ? showAdvanced : true;
|
|
49
|
+
const buttonIsDisabled = onPromptChange ? !prompt?.trim() : false;
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (__DEV__) {
|
|
53
|
+
console.log("[AIGenerationForm] RENDER - prompt:", prompt, "isGenerating:", isGenerating, "buttonIsDisabled:", buttonIsDisabled, "hideGenerateButton:", hideGenerateButton);
|
|
54
|
+
}
|
|
55
|
+
}, [prompt, isGenerating, buttonIsDisabled, hideGenerateButton]);
|
|
47
56
|
|
|
48
57
|
return (
|
|
49
58
|
<>
|
|
@@ -128,7 +137,7 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
|
|
|
128
137
|
<GenerateButton
|
|
129
138
|
onPress={onGenerate}
|
|
130
139
|
isProcessing={isGenerating}
|
|
131
|
-
isDisabled={
|
|
140
|
+
isDisabled={buttonIsDisabled}
|
|
132
141
|
text={translations.generateButton}
|
|
133
142
|
processingText={translations.generatingButton}
|
|
134
143
|
icon={generateButtonProps?.icon || "sparkles-outline"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Props-driven for 100+ apps compatibility
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React from "react";
|
|
7
|
+
import React, { useEffect } from "react";
|
|
8
8
|
import { View, StyleSheet, TouchableOpacity, type ViewStyle } from "react-native";
|
|
9
9
|
import {
|
|
10
10
|
AtomicText,
|
|
@@ -27,6 +27,8 @@ export interface GenerateButtonProps {
|
|
|
27
27
|
readonly style?: ViewStyle;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
declare const __DEV__: boolean;
|
|
31
|
+
|
|
30
32
|
export const GenerateButton: React.FC<GenerateButtonProps> = ({
|
|
31
33
|
isDisabled = false,
|
|
32
34
|
isProcessing = false,
|
|
@@ -45,11 +47,24 @@ export const GenerateButton: React.FC<GenerateButtonProps> = ({
|
|
|
45
47
|
const displayText = isProcessing && processingText ? processingText : text;
|
|
46
48
|
const finalDisplayText = costLabel ? `${displayText} (${costLabel})` : displayText;
|
|
47
49
|
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (__DEV__) {
|
|
52
|
+
console.log("[GenerateButton] MOUNTED/UPDATED - isDisabled:", isDisabled, "isProcessing:", isProcessing, "disabled:", disabled, "text:", text);
|
|
53
|
+
}
|
|
54
|
+
}, [isDisabled, isProcessing, disabled, text]);
|
|
55
|
+
|
|
56
|
+
const handlePress = () => {
|
|
57
|
+
if (__DEV__) console.log("[GenerateButton] PRESSED - disabled:", disabled, "isDisabled:", isDisabled, "isProcessing:", isProcessing);
|
|
58
|
+
if (!disabled) {
|
|
59
|
+
onPress();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
48
63
|
return (
|
|
49
64
|
<View style={[styles.container, { marginTop: tokens.spacing.xl }, style]}>
|
|
50
65
|
<View style={styles.row}>
|
|
51
66
|
<TouchableOpacity
|
|
52
|
-
onPress={
|
|
67
|
+
onPress={handlePress}
|
|
53
68
|
disabled={disabled}
|
|
54
69
|
activeOpacity={0.8}
|
|
55
70
|
style={[
|