@umituz/react-native-design-system 4.25.100 → 4.25.101
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/dist/onboarding/presentation/components/OnboardingBackground.d.ts +1 -0
- package/dist/onboarding/presentation/providers/OnboardingProvider.d.ts +1 -0
- package/dist/onboarding/presentation/types/OnboardingTheme.d.ts +1 -0
- package/package.json +1 -1
- package/src/onboarding/hooks/useOnboardingFlow.ts +31 -1
- package/src/onboarding/presentation/components/OnboardingBackground.tsx +23 -1
- package/src/onboarding/presentation/components/OnboardingScreenContent.tsx +3 -0
- package/src/onboarding/presentation/providers/OnboardingProvider.tsx +2 -0
- package/src/onboarding/presentation/screens/OnboardingScreen.tsx +14 -0
- package/src/onboarding/presentation/types/OnboardingTheme.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.101",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,14 +17,32 @@ export interface UseOnboardingFlowResult {
|
|
|
17
17
|
export const useOnboardingFlow = (): UseOnboardingFlowResult => {
|
|
18
18
|
const [isOnboardingComplete, setIsOnboardingComplete] = useState(false);
|
|
19
19
|
|
|
20
|
+
if (__DEV__) {
|
|
21
|
+
console.log("[useOnboardingFlow] Hook initialized, isOnboardingComplete:", isOnboardingComplete);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
// Load persisted state
|
|
21
25
|
useEffect(() => {
|
|
22
26
|
const isMounted = { current: true };
|
|
23
27
|
|
|
28
|
+
if (__DEV__) {
|
|
29
|
+
console.log("[useOnboardingFlow] useEffect - Loading persisted state");
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
const loadPersistedState = async () => {
|
|
33
|
+
if (__DEV__) {
|
|
34
|
+
console.log("[useOnboardingFlow] Reading from AsyncStorage:", ONBOARDING_KEY);
|
|
35
|
+
}
|
|
25
36
|
const value = await AsyncStorage.getItem(ONBOARDING_KEY);
|
|
37
|
+
if (__DEV__) {
|
|
38
|
+
console.log("[useOnboardingFlow] AsyncStorage value:", value);
|
|
39
|
+
}
|
|
26
40
|
if (isMounted.current) {
|
|
27
|
-
|
|
41
|
+
const complete = value === 'true';
|
|
42
|
+
if (__DEV__) {
|
|
43
|
+
console.log("[useOnboardingFlow] Setting isOnboardingComplete to:", complete);
|
|
44
|
+
}
|
|
45
|
+
setIsOnboardingComplete(complete);
|
|
28
46
|
}
|
|
29
47
|
};
|
|
30
48
|
|
|
@@ -33,6 +51,9 @@ export const useOnboardingFlow = (): UseOnboardingFlowResult => {
|
|
|
33
51
|
const subscription = DeviceEventEmitter.addListener(
|
|
34
52
|
'onboarding-complete',
|
|
35
53
|
() => {
|
|
54
|
+
if (__DEV__) {
|
|
55
|
+
console.log("[useOnboardingFlow] DeviceEventEmitter - onboarding-complete event");
|
|
56
|
+
}
|
|
36
57
|
if (isMounted.current) {
|
|
37
58
|
setIsOnboardingComplete(true);
|
|
38
59
|
AsyncStorage.setItem(ONBOARDING_KEY, 'true');
|
|
@@ -41,15 +62,24 @@ export const useOnboardingFlow = (): UseOnboardingFlowResult => {
|
|
|
41
62
|
);
|
|
42
63
|
|
|
43
64
|
return () => {
|
|
65
|
+
if (__DEV__) {
|
|
66
|
+
console.log("[useOnboardingFlow] Cleanup - removing event listener");
|
|
67
|
+
}
|
|
44
68
|
isMounted.current = false;
|
|
45
69
|
subscription.remove();
|
|
46
70
|
};
|
|
47
71
|
}, []);
|
|
48
72
|
|
|
49
73
|
const completeOnboarding = useCallback(async () => {
|
|
74
|
+
if (__DEV__) {
|
|
75
|
+
console.log("[useOnboardingFlow] completeOnboarding called");
|
|
76
|
+
}
|
|
50
77
|
await AsyncStorage.setItem(ONBOARDING_KEY, 'true');
|
|
51
78
|
setIsOnboardingComplete(true);
|
|
52
79
|
DeviceEventEmitter.emit('onboarding-complete');
|
|
80
|
+
if (__DEV__) {
|
|
81
|
+
console.log("[useOnboardingFlow] Onboarding marked as complete");
|
|
82
|
+
}
|
|
53
83
|
}, []);
|
|
54
84
|
|
|
55
85
|
return {
|
|
@@ -85,6 +85,7 @@ export interface OnboardingBackgroundProps {
|
|
|
85
85
|
useCustomBackground: boolean;
|
|
86
86
|
showOverlay: boolean;
|
|
87
87
|
overlayOpacity: number;
|
|
88
|
+
backgroundColor?: string; // Optional background color
|
|
88
89
|
/**
|
|
89
90
|
* Optional video background component.
|
|
90
91
|
* Required only when slides use `backgroundVideo`.
|
|
@@ -102,10 +103,31 @@ export const OnboardingBackground: React.FC<OnboardingBackgroundProps> = ({
|
|
|
102
103
|
useCustomBackground,
|
|
103
104
|
showOverlay,
|
|
104
105
|
overlayOpacity,
|
|
106
|
+
backgroundColor,
|
|
105
107
|
VideoComponent,
|
|
106
108
|
}) => {
|
|
107
109
|
if (!currentSlide) return null;
|
|
108
110
|
|
|
111
|
+
// If backgroundColor is provided, show ONLY solid color (no images/videos)
|
|
112
|
+
if (backgroundColor) {
|
|
113
|
+
if (__DEV__) {
|
|
114
|
+
console.log("[OnboardingBackground] Using solid backgroundColor:", backgroundColor);
|
|
115
|
+
}
|
|
116
|
+
return (
|
|
117
|
+
<View style={StyleSheet.absoluteFill} pointerEvents="none">
|
|
118
|
+
<View
|
|
119
|
+
style={[
|
|
120
|
+
StyleSheet.absoluteFill,
|
|
121
|
+
{ backgroundColor }
|
|
122
|
+
]}
|
|
123
|
+
/>
|
|
124
|
+
</View>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Otherwise show images/videos with optional overlay
|
|
129
|
+
const shouldShowOverlay = showOverlay;
|
|
130
|
+
|
|
109
131
|
return (
|
|
110
132
|
<View style={StyleSheet.absoluteFill} pointerEvents="none">
|
|
111
133
|
<BackgroundContent
|
|
@@ -118,7 +140,7 @@ export const OnboardingBackground: React.FC<OnboardingBackgroundProps> = ({
|
|
|
118
140
|
style={[
|
|
119
141
|
StyleSheet.absoluteFill,
|
|
120
142
|
{
|
|
121
|
-
backgroundColor:
|
|
143
|
+
backgroundColor: shouldShowOverlay
|
|
122
144
|
? `rgba(0,0,0,${overlayOpacity})`
|
|
123
145
|
: "transparent",
|
|
124
146
|
},
|
|
@@ -12,6 +12,7 @@ import { QuestionSlide } from "./QuestionSlide";
|
|
|
12
12
|
import { OnboardingFooter } from "./OnboardingFooter";
|
|
13
13
|
import { OnboardingBackground } from "./OnboardingBackground";
|
|
14
14
|
import { useOnboardingGestures } from "../hooks/useOnboardingGestures";
|
|
15
|
+
import { useOnboardingProvider } from "../providers/OnboardingProvider";
|
|
15
16
|
import type { OnboardingScreenContentProps } from "../types/OnboardingProps";
|
|
16
17
|
|
|
17
18
|
export const OnboardingScreenContent = ({
|
|
@@ -45,6 +46,7 @@ export const OnboardingScreenContent = ({
|
|
|
45
46
|
VideoComponent,
|
|
46
47
|
}: OnboardingScreenContentProps) => {
|
|
47
48
|
const { themeMode } = useTheme();
|
|
49
|
+
const { backgroundColor } = useOnboardingProvider();
|
|
48
50
|
|
|
49
51
|
const panResponder = useOnboardingGestures({
|
|
50
52
|
isFirstSlide,
|
|
@@ -78,6 +80,7 @@ export const OnboardingScreenContent = ({
|
|
|
78
80
|
useCustomBackground={useCustomBackground}
|
|
79
81
|
showOverlay={showOverlay}
|
|
80
82
|
overlayOpacity={overlayOpacity}
|
|
83
|
+
backgroundColor={backgroundColor}
|
|
81
84
|
VideoComponent={VideoComponent}
|
|
82
85
|
/>
|
|
83
86
|
|
|
@@ -17,6 +17,7 @@ export interface OnboardingTranslations {
|
|
|
17
17
|
interface OnboardingProviderValue {
|
|
18
18
|
theme: OnboardingTheme;
|
|
19
19
|
translations: OnboardingTranslations;
|
|
20
|
+
backgroundColor?: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const OnboardingScope = createContext<OnboardingProviderValue | undefined>(undefined);
|
|
@@ -41,6 +42,7 @@ export const OnboardingProvider = ({
|
|
|
41
42
|
useCustomBackground,
|
|
42
43
|
},
|
|
43
44
|
translations,
|
|
45
|
+
backgroundColor: colors.background,
|
|
44
46
|
}),
|
|
45
47
|
[colors, useCustomBackground, translations]
|
|
46
48
|
);
|
|
@@ -102,6 +102,15 @@ export const OnboardingScreen = ({
|
|
|
102
102
|
VideoComponent,
|
|
103
103
|
}: OnboardingScreenProps) => {
|
|
104
104
|
if (__DEV__) {
|
|
105
|
+
console.log("[OnboardingScreen] Component rendering");
|
|
106
|
+
console.log("[OnboardingScreen] Props:", {
|
|
107
|
+
slidesCount: slides?.length || 0,
|
|
108
|
+
storageKey,
|
|
109
|
+
showSkipButton,
|
|
110
|
+
showBackButton,
|
|
111
|
+
showProgressBar,
|
|
112
|
+
translationsProvided: !!translations,
|
|
113
|
+
});
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
const tokens = useAppDesignTokens();
|
|
@@ -158,10 +167,15 @@ export const OnboardingScreen = ({
|
|
|
158
167
|
// Early return if no slides - prevents rendering empty/broken screen
|
|
159
168
|
if (filteredSlides.length === 0) {
|
|
160
169
|
if (__DEV__) {
|
|
170
|
+
console.warn("[OnboardingScreen] No slides to display - filteredSlides is empty");
|
|
161
171
|
}
|
|
162
172
|
return null;
|
|
163
173
|
}
|
|
164
174
|
|
|
175
|
+
if (__DEV__) {
|
|
176
|
+
console.log("[OnboardingScreen] Rendering with", filteredSlides.length, "slides");
|
|
177
|
+
}
|
|
178
|
+
|
|
165
179
|
return (
|
|
166
180
|
<OnboardingProvider useCustomBackground={useCustomBackground} colors={themeColors} translations={translations}>
|
|
167
181
|
<OnboardingScreenContent
|