@rocapine/react-native-onboarding-ui 1.6.0 → 1.8.0
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/UI/OnboardingPage.js +1 -1
- package/dist/UI/OnboardingPage.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/Renderer.d.ts +0 -2
- package/dist/UI/Pages/ComposableScreen/Renderer.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/Renderer.js +13 -273
- package/dist/UI/Pages/ComposableScreen/Renderer.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +30 -0
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +19 -0
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +67 -0
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js +65 -0
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +41 -0
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.js +37 -0
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +42 -0
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js +34 -0
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +102 -0
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.js +68 -0
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +39 -0
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js +60 -0
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +78 -0
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js +119 -0
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +62 -0
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.js +68 -0
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +85 -0
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.js +64 -0
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +66 -0
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +59 -0
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +41 -0
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js +84 -0
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.d.ts +5 -0
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.js +49 -0
- package/dist/UI/Pages/ComposableScreen/elements/renderElement.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/shared.d.ts +13 -0
- package/dist/UI/Pages/ComposableScreen/elements/shared.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/shared.js +6 -0
- package/dist/UI/Pages/ComposableScreen/elements/shared.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/types.d.ts +40 -113
- package/dist/UI/Pages/ComposableScreen/types.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/types.js +33 -121
- package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
- package/dist/UI/Provider/OnboardingProgressProvider.d.ts +6 -2
- package/dist/UI/Provider/OnboardingProgressProvider.d.ts.map +1 -1
- package/dist/UI/Provider/OnboardingProgressProvider.js +4 -3
- package/dist/UI/Provider/OnboardingProgressProvider.js.map +1 -1
- package/package.json +2 -2
- package/src/UI/OnboardingPage.tsx +1 -1
- package/src/UI/Pages/ComposableScreen/Renderer.tsx +22 -430
- package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +31 -0
- package/src/UI/Pages/ComposableScreen/elements/ButtonElement.tsx +96 -0
- package/src/UI/Pages/ComposableScreen/elements/IconElement.tsx +67 -0
- package/src/UI/Pages/ComposableScreen/elements/ImageElement.tsx +52 -0
- package/src/UI/Pages/ComposableScreen/elements/InputElement.tsx +115 -0
- package/src/UI/Pages/ComposableScreen/elements/LottieElement.tsx +97 -0
- package/src/UI/Pages/ComposableScreen/elements/RadioGroupElement.tsx +181 -0
- package/src/UI/Pages/ComposableScreen/elements/RiveElement.tsx +105 -0
- package/src/UI/Pages/ComposableScreen/elements/StackElement.tsx +103 -0
- package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +95 -0
- package/src/UI/Pages/ComposableScreen/elements/VideoElement.tsx +113 -0
- package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +61 -0
- package/src/UI/Pages/ComposableScreen/elements/shared.ts +15 -0
- package/src/UI/Pages/ComposableScreen/types.ts +56 -233
- package/src/UI/Provider/OnboardingProgressProvider.tsx +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA+C;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA+C;AAC/C,0DAA0F;AAC1F,wDAAuF;AACvF,0DAA0F;AAC1F,4DAA6F;AAC7F,wDAAuF;AACvF,wDAAuF;AACvF,0DAA0F;AAC1F,0DAA0F;AAC1F,4DAA6F;AAC7F,oEAAyG;AAGzG,wDAA6D;AAApD,kHAAA,kBAAkB,OAAA;AA6Ed,QAAA,eAAe,GAAyB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC/D,OAAC,CAAC,KAAK,CAAC;IACN,OAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACzD,KAAK,EAAE,sCAAuB;QAC9B,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAe,CAAC;KACnC,CAAC;IACF,OAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,C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AAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
|
|
@@ -3,6 +3,10 @@ export declare const OnboardingProgressProvider: ({ children, initialColorScheme
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
initialColorScheme?: ColorScheme;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export type ComposableVariableEntry = {
|
|
7
|
+
value: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
};
|
|
6
10
|
export declare const OnboardingProgressContext: import("react").Context<{
|
|
7
11
|
activeStep: {
|
|
8
12
|
number: number;
|
|
@@ -14,7 +18,7 @@ export declare const OnboardingProgressContext: import("react").Context<{
|
|
|
14
18
|
}) => void;
|
|
15
19
|
totalSteps: number;
|
|
16
20
|
setTotalSteps: (_steps: number) => void;
|
|
17
|
-
composableVariables: Record<string,
|
|
18
|
-
setComposableVariable: (_key: string,
|
|
21
|
+
composableVariables: Record<string, ComposableVariableEntry>;
|
|
22
|
+
setComposableVariable: (_key: string, _entry: ComposableVariableEntry | string) => void;
|
|
19
23
|
}>;
|
|
20
24
|
//# sourceMappingURL=OnboardingProgressProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingProgressProvider.d.ts","sourceRoot":"","sources":["../../../src/UI/Provider/OnboardingProgressProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,eAAO,MAAM,0BAA0B,GAAI,mCAGxC;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAClC,
|
|
1
|
+
{"version":3,"file":"OnboardingProgressProvider.d.ts","sourceRoot":"","sources":["../../../src/UI/Provider/OnboardingProgressProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,eAAO,MAAM,0BAA0B,GAAI,mCAGxC;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAClC,4CAwBA,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;;2BAEb;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,qBAAqB,EAAE,OAAO,CAAC;KAChC;;4BAEuB,MAAM;yBACH,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;kCACpC,MAAM,UAAU,uBAAuB,GAAG,MAAM;EAC9E,CAAC"}
|
|
@@ -12,8 +12,9 @@ const OnboardingProgressProvider = ({ children, initialColorScheme = "light", })
|
|
|
12
12
|
});
|
|
13
13
|
const [totalSteps, setTotalSteps] = (0, react_1.useState)(0);
|
|
14
14
|
const [composableVariables, setComposableVariables] = (0, react_1.useState)({});
|
|
15
|
-
const setComposableVariable = (0, react_1.useCallback)((key,
|
|
16
|
-
|
|
15
|
+
const setComposableVariable = (0, react_1.useCallback)((key, entry) => {
|
|
16
|
+
const normalizedEntry = typeof entry === "string" ? { value: entry } : entry;
|
|
17
|
+
setComposableVariables((prev) => (Object.assign(Object.assign({}, prev), { [key]: normalizedEntry })));
|
|
17
18
|
}, []);
|
|
18
19
|
return ((0, jsx_runtime_1.jsx)(react_native_safe_area_context_1.SafeAreaProvider, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.ThemeProvider, { initialColorScheme: initialColorScheme, children: (0, jsx_runtime_1.jsx)(exports.OnboardingProgressContext.Provider, { value: { activeStep, setActiveStep, totalSteps, setTotalSteps, composableVariables, setComposableVariable }, children: children }) }) }));
|
|
19
20
|
};
|
|
@@ -24,6 +25,6 @@ exports.OnboardingProgressContext = (0, react_1.createContext)({
|
|
|
24
25
|
totalSteps: 0,
|
|
25
26
|
setTotalSteps: (_steps) => { },
|
|
26
27
|
composableVariables: {},
|
|
27
|
-
setComposableVariable: (_key,
|
|
28
|
+
setComposableVariable: (_key, _entry) => { },
|
|
28
29
|
});
|
|
29
30
|
//# sourceMappingURL=OnboardingProgressProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingProgressProvider.js","sourceRoot":"","sources":["../../../src/UI/Provider/OnboardingProgressProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6D;AAC7D,mFAAkE;AAClE,0DAAuD;AAGhD,MAAM,0BAA0B,GAAG,CAAC,EACzC,QAAQ,EACR,kBAAkB,GAAG,OAAO,GAI7B,EAAE,EAAE;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC;QAC3C,MAAM,EAAE,CAAC;QACT,qBAAqB,EAAE,KAAK;KAC7B,CAAC,CAAC;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAChD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,IAAA,gBAAQ,
|
|
1
|
+
{"version":3,"file":"OnboardingProgressProvider.js","sourceRoot":"","sources":["../../../src/UI/Provider/OnboardingProgressProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6D;AAC7D,mFAAkE;AAClE,0DAAuD;AAGhD,MAAM,0BAA0B,GAAG,CAAC,EACzC,QAAQ,EACR,kBAAkB,GAAG,OAAO,GAI7B,EAAE,EAAE;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC;QAC3C,MAAM,EAAE,CAAC;QACT,qBAAqB,EAAE,KAAK;KAC7B,CAAC,CAAC;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAChD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,IAAA,gBAA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"UI components and renderers for Rocapine Onboarding Studio - Built on top of the headless SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@react-native-picker/picker": "*",
|
|
46
|
-
"@rocapine/react-native-onboarding": "^1.
|
|
46
|
+
"@rocapine/react-native-onboarding": "^1.8.0",
|
|
47
47
|
"@shopify/react-native-skia": ">=1.0.0",
|
|
48
48
|
"@tanstack/react-query": ">=5.0.0",
|
|
49
49
|
"@types/react": "*",
|
|
@@ -35,7 +35,7 @@ export const OnboardingPage = ({ step, onContinue, isSandbox }: OnboardingPagePr
|
|
|
35
35
|
case 'Question':
|
|
36
36
|
return <QuestionRenderer step={step} onContinue={onContinue} theme={theme} />;
|
|
37
37
|
case 'ComposableScreen':
|
|
38
|
-
return <ComposableScreenRenderer step={step} onContinue={onContinue}
|
|
38
|
+
return <ComposableScreenRenderer step={step} onContinue={onContinue} />;
|
|
39
39
|
default:
|
|
40
40
|
if (isSandbox) {
|
|
41
41
|
// @ts-ignore
|
|
@@ -1,404 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { ScrollView, StyleSheet } from "react-native";
|
|
3
3
|
import { ComposableScreenStepType, ComposableScreenStepTypeSchema, UIElement } from "./types";
|
|
4
|
-
import { Theme } from "../../Theme/types";
|
|
5
|
-
import { defaultTheme } from "../../Theme/defaultTheme";
|
|
6
|
-
import { getTextStyle } from "../../Theme/helpers";
|
|
7
4
|
import { withErrorBoundary } from "../../ErrorBoundary";
|
|
8
5
|
import { OnboardingTemplate } from "../../Templates/OnboardingTemplate";
|
|
9
6
|
import { OnboardingProgressContext } from "../../Provider/OnboardingProgressProvider";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
autoPlay?: boolean;
|
|
14
|
-
loop?: boolean;
|
|
15
|
-
speed?: number;
|
|
16
|
-
style?: object;
|
|
17
|
-
}> | null = null;
|
|
18
|
-
try {
|
|
19
|
-
LottieView = require("lottie-react-native").default;
|
|
20
|
-
} catch {
|
|
21
|
-
// lottie-react-native not installed
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Metro cannot tree-shake optional peer deps at runtime; the try/catch pattern
|
|
25
|
-
// below is the standard React Native approach for optional native modules.
|
|
26
|
-
type VideoUIElement = Extract<UIElement, { type: "Video" }>;
|
|
27
|
-
let VideoElementComponent: React.ComponentType<{ element: VideoUIElement; style: object }> | null = null;
|
|
28
|
-
try {
|
|
29
|
-
const { VideoView, useVideoPlayer } = require("expo-video");
|
|
30
|
-
VideoElementComponent = ({ element, style }: { element: VideoUIElement; style: object }) => {
|
|
31
|
-
const player = useVideoPlayer(element.props.url, (p: any) => {
|
|
32
|
-
p.loop = element.props.loop ?? false;
|
|
33
|
-
p.muted = element.props.muted ?? true;
|
|
34
|
-
if (element.props.autoPlay) p.play();
|
|
35
|
-
});
|
|
36
|
-
return (
|
|
37
|
-
<VideoView
|
|
38
|
-
player={player}
|
|
39
|
-
style={style}
|
|
40
|
-
allowsFullscreen={false}
|
|
41
|
-
nativeControls={element.props.controls ?? false}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
} catch {
|
|
46
|
-
// expo-video not installed
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
type InputUIElement = Extract<UIElement, { type: "Input" }>;
|
|
50
|
-
const InputElementComponent = ({ element, theme, variables, onVariableChange }: { element: InputUIElement; theme: Theme; variables: Record<string, string>; onVariableChange: (key: string, value: string) => void }) => {
|
|
51
|
-
const persistedValue = element.props.variableName ? variables[element.props.variableName] : undefined;
|
|
52
|
-
const [value, setValue] = useState(persistedValue ?? element.props.defaultValue ?? "");
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (element.props.variableName && element.props.defaultValue && persistedValue === undefined) {
|
|
56
|
-
onVariableChange(element.props.variableName, element.props.defaultValue);
|
|
57
|
-
}
|
|
58
|
-
}, []);
|
|
59
|
-
|
|
60
|
-
const handleChange = (text: string) => {
|
|
61
|
-
setValue(text);
|
|
62
|
-
if (element.props.variableName) {
|
|
63
|
-
onVariableChange(element.props.variableName, text);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<View
|
|
69
|
-
style={{
|
|
70
|
-
backgroundColor: element.props.backgroundColor ?? theme.colors.neutral.lowest,
|
|
71
|
-
borderWidth: element.props.borderWidth ?? 1,
|
|
72
|
-
borderRadius: element.props.borderRadius ?? 8,
|
|
73
|
-
borderColor: element.props.borderColor ?? theme.colors.neutral.low,
|
|
74
|
-
width: element.props.width,
|
|
75
|
-
height: element.props.height,
|
|
76
|
-
opacity: element.props.opacity,
|
|
77
|
-
margin: element.props.margin,
|
|
78
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
79
|
-
marginVertical: element.props.marginVertical,
|
|
80
|
-
overflow: "hidden",
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
<TextInput
|
|
84
|
-
value={value}
|
|
85
|
-
onChangeText={handleChange}
|
|
86
|
-
placeholder={element.props.placeholder}
|
|
87
|
-
placeholderTextColor={element.props.placeholderColor ?? theme.colors.text.tertiary}
|
|
88
|
-
keyboardType={element.props.keyboardType ?? "default"}
|
|
89
|
-
returnKeyType={element.props.returnKeyType ?? "done"}
|
|
90
|
-
autoCapitalize={element.props.autoCapitalize ?? "sentences"}
|
|
91
|
-
secureTextEntry={element.props.secureTextEntry ?? false}
|
|
92
|
-
maxLength={element.props.maxLength}
|
|
93
|
-
multiline={element.props.multiline ?? false}
|
|
94
|
-
numberOfLines={element.props.numberOfLines}
|
|
95
|
-
editable={element.props.editable ?? true}
|
|
96
|
-
style={{
|
|
97
|
-
flex: 1,
|
|
98
|
-
color: element.props.color ?? theme.colors.text.primary,
|
|
99
|
-
fontSize: element.props.fontSize ?? theme.typography.textStyles.body.fontSize,
|
|
100
|
-
fontWeight: element.props.fontWeight as any,
|
|
101
|
-
textAlign: element.props.textAlign,
|
|
102
|
-
padding: element.props.padding ?? 12,
|
|
103
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
104
|
-
paddingVertical: element.props.paddingVertical,
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
</View>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
type RiveUIElement = Extract<UIElement, { type: "Rive" }>;
|
|
112
|
-
let RiveElementComponent: React.ComponentType<{ element: RiveUIElement; riveStyle: object }> | null = null;
|
|
113
|
-
try {
|
|
114
|
-
const riveModule = require("rive-react-native");
|
|
115
|
-
const Rive = riveModule.default;
|
|
116
|
-
const { Fit, Alignment } = riveModule;
|
|
117
|
-
RiveElementComponent = ({ element, riveStyle }: { element: RiveUIElement; riveStyle: object }) => {
|
|
118
|
-
return (
|
|
119
|
-
<Rive
|
|
120
|
-
url={element.props.url}
|
|
121
|
-
autoplay={element.props.autoplay ?? true}
|
|
122
|
-
fit={element.props.fit ? Fit[element.props.fit] : Fit.Contain}
|
|
123
|
-
alignment={element.props.alignment ? Alignment[element.props.alignment] : Alignment.Center}
|
|
124
|
-
artboardName={element.props.artboardName}
|
|
125
|
-
stateMachineName={element.props.stateMachineName}
|
|
126
|
-
style={riveStyle}
|
|
127
|
-
onError={console.error}
|
|
128
|
-
/>
|
|
129
|
-
);
|
|
130
|
-
};
|
|
131
|
-
} catch {
|
|
132
|
-
// rive-react-native not installed - will show fallback if Rive is used
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const interpolate = (template: string, variables: Record<string, string>): string =>
|
|
136
|
-
template.replace(/\{\{([^}]+?)\}\}/g, (_, key) => variables[key] ?? "");
|
|
7
|
+
import { useTheme } from "../../Theme/useTheme";
|
|
8
|
+
import { RenderContext } from "./elements/shared";
|
|
9
|
+
import { renderElement } from "./elements/renderElement";
|
|
137
10
|
|
|
138
11
|
type ContentProps = {
|
|
139
12
|
step: ComposableScreenStepType;
|
|
140
13
|
onContinue: () => void;
|
|
141
|
-
theme?: Theme;
|
|
142
14
|
};
|
|
143
15
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<View
|
|
148
|
-
key={element.id}
|
|
149
|
-
style={{
|
|
150
|
-
flexDirection: element.type === "XStack" ? "row" : "column",
|
|
151
|
-
gap: element.props.gap,
|
|
152
|
-
padding: element.props.padding,
|
|
153
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
154
|
-
paddingVertical: element.props.paddingVertical,
|
|
155
|
-
margin: element.props.margin,
|
|
156
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
157
|
-
marginVertical: element.props.marginVertical,
|
|
158
|
-
flex: element.props.flex,
|
|
159
|
-
width: element.props.width,
|
|
160
|
-
height: element.props.height,
|
|
161
|
-
minWidth: element.props.minWidth,
|
|
162
|
-
maxWidth: element.props.maxWidth,
|
|
163
|
-
minHeight: element.props.minHeight,
|
|
164
|
-
maxHeight: element.props.maxHeight,
|
|
165
|
-
flexShrink: element.props.flexShrink ?? (parentType === "XStack" ? 1 : undefined),
|
|
166
|
-
flexWrap: element.props.flexWrap,
|
|
167
|
-
alignItems: element.props.alignItems,
|
|
168
|
-
justifyContent: element.props.justifyContent,
|
|
169
|
-
backgroundColor: element.props.backgroundColor,
|
|
170
|
-
borderWidth: element.props.borderWidth,
|
|
171
|
-
borderRadius: element.props.borderRadius,
|
|
172
|
-
borderColor: element.props.borderColor,
|
|
173
|
-
overflow: element.props.overflow,
|
|
174
|
-
opacity: element.props.opacity,
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
{element.children.map((child) => renderElement(child, theme, variables, setVariable, element.type))}
|
|
178
|
-
</View>
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (element.type === "Text") {
|
|
183
|
-
const content = element.props.mode === "expression"
|
|
184
|
-
? interpolate(element.props.content, variables)
|
|
185
|
-
: element.props.content;
|
|
186
|
-
return (
|
|
187
|
-
<Text
|
|
188
|
-
key={element.id}
|
|
189
|
-
style={{
|
|
190
|
-
fontSize: element.props.fontSize,
|
|
191
|
-
fontWeight: element.props.fontWeight as any,
|
|
192
|
-
color: element.props.color ?? theme.colors.text.primary,
|
|
193
|
-
textAlign: element.props.textAlign,
|
|
194
|
-
letterSpacing: element.props.letterSpacing,
|
|
195
|
-
lineHeight: element.props.lineHeight,
|
|
196
|
-
backgroundColor: element.props.backgroundColor,
|
|
197
|
-
padding: element.props.padding,
|
|
198
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
199
|
-
paddingVertical: element.props.paddingVertical,
|
|
200
|
-
margin: element.props.margin,
|
|
201
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
202
|
-
marginVertical: element.props.marginVertical,
|
|
203
|
-
borderWidth: element.props.borderWidth,
|
|
204
|
-
borderRadius: element.props.borderRadius,
|
|
205
|
-
borderColor: element.props.borderColor,
|
|
206
|
-
opacity: element.props.opacity,
|
|
207
|
-
flexShrink: parentType === "XStack" ? 1 : undefined,
|
|
208
|
-
}}
|
|
209
|
-
>
|
|
210
|
-
{content}
|
|
211
|
-
</Text>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (element.type === "Image") {
|
|
216
|
-
const hasExplicitHeight = element.props.height !== undefined;
|
|
217
|
-
const aspectRatio = hasExplicitHeight
|
|
218
|
-
? undefined
|
|
219
|
-
: (element.props.aspectRatio ?? 16 / 9);
|
|
220
|
-
return (
|
|
221
|
-
<Image
|
|
222
|
-
key={element.id}
|
|
223
|
-
source={{ uri: element.props.url }}
|
|
224
|
-
resizeMode={element.props.resizeMode ?? "cover"}
|
|
225
|
-
style={{
|
|
226
|
-
width: element.props.width ?? "100%",
|
|
227
|
-
height: element.props.height,
|
|
228
|
-
aspectRatio,
|
|
229
|
-
borderRadius: element.props.borderRadius,
|
|
230
|
-
borderWidth: element.props.borderWidth,
|
|
231
|
-
borderColor: element.props.borderColor,
|
|
232
|
-
opacity: element.props.opacity,
|
|
233
|
-
margin: element.props.margin,
|
|
234
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
235
|
-
marginVertical: element.props.marginVertical,
|
|
236
|
-
padding: element.props.padding,
|
|
237
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
238
|
-
paddingVertical: element.props.paddingVertical,
|
|
239
|
-
}}
|
|
240
|
-
/>
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (element.type === "Lottie") {
|
|
245
|
-
const wrapperStyle = {
|
|
246
|
-
width: element.props.width ?? ("100%" as `${number}%`),
|
|
247
|
-
height: element.props.height ?? 200,
|
|
248
|
-
opacity: element.props.opacity,
|
|
249
|
-
margin: element.props.margin,
|
|
250
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
251
|
-
marginVertical: element.props.marginVertical,
|
|
252
|
-
padding: element.props.padding,
|
|
253
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
254
|
-
paddingVertical: element.props.paddingVertical,
|
|
255
|
-
borderWidth: element.props.borderWidth,
|
|
256
|
-
borderRadius: element.props.borderRadius,
|
|
257
|
-
borderColor: element.props.borderColor,
|
|
258
|
-
overflow: "hidden" as const,
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
if (!LottieView) {
|
|
262
|
-
return (
|
|
263
|
-
<View key={element.id} style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }]}>
|
|
264
|
-
<Text style={[styles.mediaFallbackText, getTextStyle(theme, "caption"), { color: theme.colors.text.tertiary }]}>
|
|
265
|
-
Install lottie-react-native to render Lottie animations.
|
|
266
|
-
</Text>
|
|
267
|
-
</View>
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return (
|
|
272
|
-
<View key={element.id} style={wrapperStyle}>
|
|
273
|
-
<LottieView
|
|
274
|
-
source={{ uri: element.props.source }}
|
|
275
|
-
autoPlay={element.props.autoPlay ?? true}
|
|
276
|
-
loop={element.props.loop ?? true}
|
|
277
|
-
speed={element.props.speed}
|
|
278
|
-
style={styles.fill}
|
|
279
|
-
/>
|
|
280
|
-
</View>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (element.type === "Rive") {
|
|
285
|
-
const wrapperStyle = {
|
|
286
|
-
width: element.props.width ?? ("100%" as `${number}%`),
|
|
287
|
-
height: element.props.height ?? 200,
|
|
288
|
-
opacity: element.props.opacity,
|
|
289
|
-
margin: element.props.margin,
|
|
290
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
291
|
-
marginVertical: element.props.marginVertical,
|
|
292
|
-
padding: element.props.padding,
|
|
293
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
294
|
-
paddingVertical: element.props.paddingVertical,
|
|
295
|
-
borderWidth: element.props.borderWidth,
|
|
296
|
-
borderRadius: element.props.borderRadius,
|
|
297
|
-
borderColor: element.props.borderColor,
|
|
298
|
-
overflow: "hidden" as const,
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
if (!RiveElementComponent) {
|
|
302
|
-
return (
|
|
303
|
-
<View key={element.id} style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }]}>
|
|
304
|
-
<Text style={[styles.mediaFallbackText, getTextStyle(theme, "caption"), { color: theme.colors.text.tertiary }]}>
|
|
305
|
-
Install rive-react-native to render Rive animations.
|
|
306
|
-
</Text>
|
|
307
|
-
</View>
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return (
|
|
312
|
-
<View key={element.id} style={wrapperStyle}>
|
|
313
|
-
<RiveElementComponent element={element} riveStyle={styles.fill} />
|
|
314
|
-
</View>
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (element.type === "Icon") {
|
|
319
|
-
const icons = require("lucide-react-native");
|
|
320
|
-
const IconComp = icons[element.props.name] as React.ComponentType<{
|
|
321
|
-
size?: number;
|
|
322
|
-
color?: string;
|
|
323
|
-
strokeWidth?: number;
|
|
324
|
-
}> | undefined;
|
|
325
|
-
return (
|
|
326
|
-
<View
|
|
327
|
-
key={element.id}
|
|
328
|
-
style={{
|
|
329
|
-
width: element.props.width,
|
|
330
|
-
height: element.props.height,
|
|
331
|
-
margin: element.props.margin,
|
|
332
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
333
|
-
marginVertical: element.props.marginVertical,
|
|
334
|
-
padding: element.props.padding,
|
|
335
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
336
|
-
paddingVertical: element.props.paddingVertical,
|
|
337
|
-
borderWidth: element.props.borderWidth,
|
|
338
|
-
borderRadius: element.props.borderRadius,
|
|
339
|
-
borderColor: element.props.borderColor,
|
|
340
|
-
opacity: element.props.opacity,
|
|
341
|
-
}}
|
|
342
|
-
>
|
|
343
|
-
{IconComp ? (
|
|
344
|
-
<IconComp
|
|
345
|
-
size={element.props.size ?? 24}
|
|
346
|
-
color={element.props.color ?? theme.colors.text.primary}
|
|
347
|
-
strokeWidth={element.props.strokeWidth ?? 2}
|
|
348
|
-
/>
|
|
349
|
-
) : null}
|
|
350
|
-
</View>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (element.type === "Video") {
|
|
355
|
-
const wrapperStyle = {
|
|
356
|
-
width: element.props.width ?? ("100%" as `${number}%`),
|
|
357
|
-
height: element.props.height ?? 200,
|
|
358
|
-
opacity: element.props.opacity,
|
|
359
|
-
margin: element.props.margin,
|
|
360
|
-
marginHorizontal: element.props.marginHorizontal,
|
|
361
|
-
marginVertical: element.props.marginVertical,
|
|
362
|
-
padding: element.props.padding,
|
|
363
|
-
paddingHorizontal: element.props.paddingHorizontal,
|
|
364
|
-
paddingVertical: element.props.paddingVertical,
|
|
365
|
-
borderWidth: element.props.borderWidth,
|
|
366
|
-
borderRadius: element.props.borderRadius,
|
|
367
|
-
borderColor: element.props.borderColor,
|
|
368
|
-
overflow: "hidden" as const,
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
if (!VideoElementComponent) {
|
|
372
|
-
return (
|
|
373
|
-
<View key={element.id} style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }]}>
|
|
374
|
-
<Text style={[styles.mediaFallbackText, getTextStyle(theme, "caption"), { color: theme.colors.text.tertiary }]}>
|
|
375
|
-
Install expo-video to render videos.
|
|
376
|
-
</Text>
|
|
377
|
-
</View>
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
return (
|
|
382
|
-
<View key={element.id} style={wrapperStyle}>
|
|
383
|
-
<VideoElementComponent element={element} style={styles.fill} />
|
|
384
|
-
</View>
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (element.type === "Input") {
|
|
389
|
-
return <InputElementComponent key={element.id} element={element} theme={theme} variables={variables} onVariableChange={setVariable} />;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
return null;
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
const ComposableScreenRendererBase = ({ step, onContinue, theme = defaultTheme }: ContentProps) => {
|
|
16
|
+
const ComposableScreenRendererBase = ({ step, onContinue }: ContentProps) => {
|
|
17
|
+
const { theme } = useTheme();
|
|
396
18
|
const validatedData = useMemo(() => ComposableScreenStepTypeSchema.parse(step), [step]);
|
|
397
19
|
const { elements } = validatedData.payload;
|
|
398
20
|
const { composableVariables, setComposableVariable } = useContext(OnboardingProgressContext);
|
|
21
|
+
|
|
22
|
+
const renderChildren = (children: UIElement[], parentType: "XStack" | "YStack") =>
|
|
23
|
+
children.map((child) => renderElement(child, ctx, parentType));
|
|
24
|
+
|
|
25
|
+
const ctx: RenderContext = {
|
|
26
|
+
theme,
|
|
27
|
+
variables: composableVariables,
|
|
28
|
+
setVariable: setComposableVariable,
|
|
29
|
+
onContinue,
|
|
30
|
+
renderChildren,
|
|
31
|
+
};
|
|
32
|
+
|
|
399
33
|
return (
|
|
400
34
|
<OnboardingTemplate
|
|
401
|
-
step={
|
|
35
|
+
step={validatedData}
|
|
402
36
|
onContinue={onContinue}
|
|
403
37
|
theme={theme}
|
|
404
38
|
>
|
|
@@ -408,58 +42,16 @@ const ComposableScreenRendererBase = ({ step, onContinue, theme = defaultTheme }
|
|
|
408
42
|
alwaysBounceVertical={false}
|
|
409
43
|
keyboardShouldPersistTaps="handled"
|
|
410
44
|
>
|
|
411
|
-
{elements.map((element) => renderElement(element,
|
|
412
|
-
<View style={styles.bottomSection}>
|
|
413
|
-
<TouchableOpacity
|
|
414
|
-
style={[styles.ctaButton, { backgroundColor: theme.colors.primary }]}
|
|
415
|
-
onPress={onContinue}
|
|
416
|
-
activeOpacity={0.8}
|
|
417
|
-
>
|
|
418
|
-
<Text
|
|
419
|
-
style={[
|
|
420
|
-
getTextStyle(theme, "button"),
|
|
421
|
-
{ color: theme.colors.text.opposite },
|
|
422
|
-
]}
|
|
423
|
-
>
|
|
424
|
-
{validatedData.continueButtonLabel}
|
|
425
|
-
</Text>
|
|
426
|
-
</TouchableOpacity>
|
|
427
|
-
</View>
|
|
45
|
+
{elements.map((element) => renderElement(element, ctx))}
|
|
428
46
|
</ScrollView>
|
|
429
47
|
</OnboardingTemplate>
|
|
430
|
-
)
|
|
48
|
+
);
|
|
431
49
|
};
|
|
432
50
|
|
|
433
51
|
const styles = StyleSheet.create({
|
|
434
|
-
container: {
|
|
435
|
-
flex: 1,
|
|
436
|
-
},
|
|
437
|
-
fill: {
|
|
438
|
-
width: "100%",
|
|
439
|
-
height: "100%",
|
|
440
|
-
},
|
|
441
52
|
scrollContent: {
|
|
442
53
|
flexGrow: 1,
|
|
443
54
|
},
|
|
444
|
-
bottomSection: {
|
|
445
|
-
paddingHorizontal: 32,
|
|
446
|
-
alignItems: "center",
|
|
447
|
-
},
|
|
448
|
-
ctaButton: {
|
|
449
|
-
borderRadius: 90,
|
|
450
|
-
paddingVertical: 18,
|
|
451
|
-
paddingHorizontal: 24,
|
|
452
|
-
minWidth: 234,
|
|
453
|
-
alignItems: "center",
|
|
454
|
-
},
|
|
455
|
-
mediaFallback: {
|
|
456
|
-
alignItems: "center",
|
|
457
|
-
justifyContent: "center",
|
|
458
|
-
},
|
|
459
|
-
mediaFallbackText: {
|
|
460
|
-
textAlign: "center",
|
|
461
|
-
paddingHorizontal: 16,
|
|
462
|
-
},
|
|
463
55
|
});
|
|
464
56
|
|
|
465
57
|
export const ComposableScreenRenderer = withErrorBoundary(ComposableScreenRendererBase, "ComposableScreen");
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export type BaseBoxProps = {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
opacity?: number;
|
|
7
|
+
margin?: number;
|
|
8
|
+
marginHorizontal?: number;
|
|
9
|
+
marginVertical?: number;
|
|
10
|
+
padding?: number;
|
|
11
|
+
paddingHorizontal?: number;
|
|
12
|
+
paddingVertical?: number;
|
|
13
|
+
borderWidth?: number;
|
|
14
|
+
borderRadius?: number;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const BaseBoxPropsSchema = z.object({
|
|
19
|
+
width: z.number().min(0).optional(),
|
|
20
|
+
height: z.number().min(0).optional(),
|
|
21
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
22
|
+
margin: z.number().optional(),
|
|
23
|
+
marginHorizontal: z.number().optional(),
|
|
24
|
+
marginVertical: z.number().optional(),
|
|
25
|
+
padding: z.number().min(0).optional(),
|
|
26
|
+
paddingHorizontal: z.number().min(0).optional(),
|
|
27
|
+
paddingVertical: z.number().min(0).optional(),
|
|
28
|
+
borderWidth: z.number().min(0).optional(),
|
|
29
|
+
borderRadius: z.number().min(0).optional(),
|
|
30
|
+
borderColor: z.string().optional(),
|
|
31
|
+
});
|