@rocapine/react-native-onboarding-ui 1.30.0 → 1.32.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.
Files changed (62) hide show
  1. package/dist/UI/Pages/ComposableScreen/elements/AnimatedBox.d.ts +21 -0
  2. package/dist/UI/Pages/ComposableScreen/elements/AnimatedBox.d.ts.map +1 -0
  3. package/dist/UI/Pages/ComposableScreen/elements/AnimatedBox.js +140 -0
  4. package/dist/UI/Pages/ComposableScreen/elements/AnimatedBox.js.map +1 -0
  5. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +220 -0
  6. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
  7. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +83 -0
  8. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
  9. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +640 -0
  10. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
  11. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts +160 -0
  12. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
  13. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts +160 -0
  14. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
  15. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +160 -0
  16. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
  17. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +160 -0
  18. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -1
  19. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +160 -0
  20. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
  21. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +160 -0
  22. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -1
  23. package/dist/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts +160 -0
  24. package/dist/UI/Pages/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +1 -1
  25. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +160 -0
  26. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
  27. package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.d.ts +160 -0
  28. package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.d.ts.map +1 -1
  29. package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.js +2 -8
  30. package/dist/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.js.map +1 -1
  31. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +160 -0
  32. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
  33. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +160 -0
  34. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
  35. package/dist/UI/Pages/ComposableScreen/elements/SafeAreaViewElement.d.ts +160 -0
  36. package/dist/UI/Pages/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +1 -1
  37. package/dist/UI/Pages/ComposableScreen/elements/ScrollViewElement.d.ts +160 -0
  38. package/dist/UI/Pages/ComposableScreen/elements/ScrollViewElement.d.ts.map +1 -1
  39. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +160 -0
  40. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -1
  41. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +245 -2
  42. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
  43. package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +58 -6
  44. package/dist/UI/Pages/ComposableScreen/elements/TextElement.js.map +1 -1
  45. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +160 -0
  46. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
  47. package/dist/UI/Pages/ComposableScreen/elements/ZStackElement.d.ts +160 -0
  48. package/dist/UI/Pages/ComposableScreen/elements/ZStackElement.d.ts.map +1 -1
  49. package/dist/UI/Pages/ComposableScreen/elements/buildAnimation.d.ts +9 -0
  50. package/dist/UI/Pages/ComposableScreen/elements/buildAnimation.d.ts.map +1 -0
  51. package/dist/UI/Pages/ComposableScreen/elements/buildAnimation.js +106 -0
  52. package/dist/UI/Pages/ComposableScreen/elements/buildAnimation.js.map +1 -0
  53. package/dist/UI/Pages/ComposableScreen/elements/renderElement.d.ts.map +1 -1
  54. package/dist/UI/Pages/ComposableScreen/elements/renderElement.js +72 -58
  55. package/dist/UI/Pages/ComposableScreen/elements/renderElement.js.map +1 -1
  56. package/package.json +1 -1
  57. package/src/UI/Pages/ComposableScreen/elements/AnimatedBox.tsx +133 -0
  58. package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +211 -0
  59. package/src/UI/Pages/ComposableScreen/elements/ProgressIndicatorElement.tsx +1 -9
  60. package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +93 -5
  61. package/src/UI/Pages/ComposableScreen/elements/buildAnimation.ts +83 -0
  62. package/src/UI/Pages/ComposableScreen/elements/renderElement.tsx +28 -1
@@ -22,70 +22,84 @@ const SafeAreaViewElement_1 = require("./SafeAreaViewElement");
22
22
  const ScrollViewElement_1 = require("./ScrollViewElement");
23
23
  const KeyboardAvoidingViewElement_1 = require("./KeyboardAvoidingViewElement");
24
24
  const ProgressIndicatorElement_1 = require("./ProgressIndicatorElement");
25
+ const AnimatedBox_1 = require("./AnimatedBox");
25
26
  const renderElement = (element, ctx, parentType) => {
26
27
  if (element.renderWhen) {
27
28
  const flatVars = Object.fromEntries(Object.entries(ctx.variables).map(([k, v]) => [k, v === null || v === void 0 ? void 0 : v.value]));
28
29
  if (!(0, react_native_onboarding_1.evaluateCondition)(element.renderWhen, flatVars))
29
30
  return null;
30
31
  }
31
- if (element.type === "YStack" || element.type === "XStack") {
32
- return (0, jsx_runtime_1.jsx)(StackElement_1.StackElementComponent, { element: element, ctx: ctx, parentType: parentType }, element.id);
33
- }
34
- if (element.type === "Text") {
35
- return (0, jsx_runtime_1.jsx)(TextElement_1.TextElementComponent, { element: element, ctx: ctx, parentType: parentType }, element.id);
36
- }
37
- if (element.type === "Image") {
38
- return (0, jsx_runtime_1.jsx)(ImageElement_1.ImageElementComponent, { element: element, ctx: ctx }, element.id);
39
- }
40
- if (element.type === "Lottie") {
41
- return (0, jsx_runtime_1.jsx)(LottieElement_1.LottieElementComponent, { element: element, ctx: ctx }, element.id);
42
- }
43
- if (element.type === "Rive") {
44
- return (0, jsx_runtime_1.jsx)(RiveElement_1.RiveElementRenderer, { element: element, ctx: ctx }, element.id);
45
- }
46
- if (element.type === "Icon") {
47
- return (0, jsx_runtime_1.jsx)(IconElement_1.IconElementComponent, { element: element, ctx: ctx }, element.id);
48
- }
49
- if (element.type === "Video") {
50
- return (0, jsx_runtime_1.jsx)(VideoElement_1.VideoElementRenderer, { element: element, ctx: ctx }, element.id);
51
- }
52
- if (element.type === "Input") {
53
- return (0, jsx_runtime_1.jsx)(InputElement_1.InputElementComponent, { element: element, ctx: ctx }, element.id);
54
- }
55
- if (element.type === "RadioGroup") {
56
- return (0, jsx_runtime_1.jsx)(RadioGroupElement_1.RadioGroupComponent, { element: element, ctx: ctx }, element.id);
57
- }
58
- if (element.type === "CheckboxGroup") {
59
- return (0, jsx_runtime_1.jsx)(CheckboxGroupElement_1.CheckboxGroupComponent, { element: element, ctx: ctx }, element.id);
60
- }
61
- if (element.type === "Button") {
62
- return (0, jsx_runtime_1.jsx)(ButtonElement_1.ButtonElementComponent, { element: element, ctx: ctx }, element.id);
63
- }
64
- if (element.type === "DatePicker") {
65
- return (0, jsx_runtime_1.jsx)(DatePickerElement_1.DatePickerElementComponent, { element: element, ctx: ctx }, element.id);
66
- }
67
- if (element.type === "WheelPicker") {
68
- return (0, jsx_runtime_1.jsx)(WheelPickerElement_1.WheelPickerElementComponent, { element: element, ctx: ctx }, element.id);
69
- }
70
- if (element.type === "Carousel") {
71
- return (0, jsx_runtime_1.jsx)(CarouselElement_1.CarouselElementComponent, { element: element, ctx: ctx }, element.id);
72
- }
73
- if (element.type === "ZStack") {
74
- return (0, jsx_runtime_1.jsx)(ZStackElement_1.ZStackElementComponent, { element: element, ctx: ctx }, element.id);
75
- }
76
- if (element.type === "SafeAreaView") {
77
- return (0, jsx_runtime_1.jsx)(SafeAreaViewElement_1.SafeAreaViewElementComponent, { element: element, ctx: ctx }, element.id);
78
- }
79
- if (element.type === "ScrollView") {
80
- return (0, jsx_runtime_1.jsx)(ScrollViewElement_1.ScrollViewElementComponent, { element: element, ctx: ctx }, element.id);
81
- }
82
- if (element.type === "KeyboardAvoidingView") {
83
- return (0, jsx_runtime_1.jsx)(KeyboardAvoidingViewElement_1.KeyboardAvoidingViewElementComponent, { element: element, ctx: ctx }, element.id);
84
- }
85
- if (element.type === "ProgressIndicator") {
86
- return (0, jsx_runtime_1.jsx)(ProgressIndicatorElement_1.ProgressIndicatorElementComponent, { element: element, ctx: ctx }, element.id);
87
- }
88
- return null;
32
+ // Dispatch to the concrete element renderer. Captured into `node` so a single
33
+ // AnimatedBox wrapper can apply animation/transform to any of the 15 types.
34
+ const node = (() => {
35
+ if (element.type === "YStack" || element.type === "XStack") {
36
+ return (0, jsx_runtime_1.jsx)(StackElement_1.StackElementComponent, { element: element, ctx: ctx, parentType: parentType }, element.id);
37
+ }
38
+ if (element.type === "Text") {
39
+ return (0, jsx_runtime_1.jsx)(TextElement_1.TextElementComponent, { element: element, ctx: ctx, parentType: parentType }, element.id);
40
+ }
41
+ if (element.type === "Image") {
42
+ return (0, jsx_runtime_1.jsx)(ImageElement_1.ImageElementComponent, { element: element, ctx: ctx }, element.id);
43
+ }
44
+ if (element.type === "Lottie") {
45
+ return (0, jsx_runtime_1.jsx)(LottieElement_1.LottieElementComponent, { element: element, ctx: ctx }, element.id);
46
+ }
47
+ if (element.type === "Rive") {
48
+ return (0, jsx_runtime_1.jsx)(RiveElement_1.RiveElementRenderer, { element: element, ctx: ctx }, element.id);
49
+ }
50
+ if (element.type === "Icon") {
51
+ return (0, jsx_runtime_1.jsx)(IconElement_1.IconElementComponent, { element: element, ctx: ctx }, element.id);
52
+ }
53
+ if (element.type === "Video") {
54
+ return (0, jsx_runtime_1.jsx)(VideoElement_1.VideoElementRenderer, { element: element, ctx: ctx }, element.id);
55
+ }
56
+ if (element.type === "Input") {
57
+ return (0, jsx_runtime_1.jsx)(InputElement_1.InputElementComponent, { element: element, ctx: ctx }, element.id);
58
+ }
59
+ if (element.type === "RadioGroup") {
60
+ return (0, jsx_runtime_1.jsx)(RadioGroupElement_1.RadioGroupComponent, { element: element, ctx: ctx }, element.id);
61
+ }
62
+ if (element.type === "CheckboxGroup") {
63
+ return (0, jsx_runtime_1.jsx)(CheckboxGroupElement_1.CheckboxGroupComponent, { element: element, ctx: ctx }, element.id);
64
+ }
65
+ if (element.type === "Button") {
66
+ return (0, jsx_runtime_1.jsx)(ButtonElement_1.ButtonElementComponent, { element: element, ctx: ctx }, element.id);
67
+ }
68
+ if (element.type === "DatePicker") {
69
+ return (0, jsx_runtime_1.jsx)(DatePickerElement_1.DatePickerElementComponent, { element: element, ctx: ctx }, element.id);
70
+ }
71
+ if (element.type === "WheelPicker") {
72
+ return (0, jsx_runtime_1.jsx)(WheelPickerElement_1.WheelPickerElementComponent, { element: element, ctx: ctx }, element.id);
73
+ }
74
+ if (element.type === "Carousel") {
75
+ return (0, jsx_runtime_1.jsx)(CarouselElement_1.CarouselElementComponent, { element: element, ctx: ctx }, element.id);
76
+ }
77
+ if (element.type === "ZStack") {
78
+ return (0, jsx_runtime_1.jsx)(ZStackElement_1.ZStackElementComponent, { element: element, ctx: ctx }, element.id);
79
+ }
80
+ if (element.type === "SafeAreaView") {
81
+ return (0, jsx_runtime_1.jsx)(SafeAreaViewElement_1.SafeAreaViewElementComponent, { element: element, ctx: ctx }, element.id);
82
+ }
83
+ if (element.type === "ScrollView") {
84
+ return (0, jsx_runtime_1.jsx)(ScrollViewElement_1.ScrollViewElementComponent, { element: element, ctx: ctx }, element.id);
85
+ }
86
+ if (element.type === "KeyboardAvoidingView") {
87
+ return (0, jsx_runtime_1.jsx)(KeyboardAvoidingViewElement_1.KeyboardAvoidingViewElementComponent, { element: element, ctx: ctx }, element.id);
88
+ }
89
+ if (element.type === "ProgressIndicator") {
90
+ return (0, jsx_runtime_1.jsx)(ProgressIndicatorElement_1.ProgressIndicatorElementComponent, { element: element, ctx: ctx }, element.id);
91
+ }
92
+ return null;
93
+ })();
94
+ // Wrap only when motion is requested — zero overhead (no extra view) otherwise.
95
+ // Cast to BaseBoxProps: not every element's props type extends it (e.g.
96
+ // WheelPicker), but the animation/transform/flex/alignSelf fields are all
97
+ // optional BaseBoxProps members and simply read as undefined when absent.
98
+ const p = element.props;
99
+ if (node !== null && (p.animation || p.transform)) {
100
+ return ((0, jsx_runtime_1.jsx)(AnimatedBox_1.AnimatedBox, { animation: p.animation, transform: p.transform, flex: p.flex, alignSelf: p.alignSelf, children: node }, element.id));
101
+ }
102
+ return node;
89
103
  };
90
104
  exports.renderElement = renderElement;
91
105
  //# sourceMappingURL=renderElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":";;;;AACA,+EAAsE;AAGtE,iDAAuD;AACvD,+CAAqD;AACrD,iDAAuD;AACvD,mDAAyD;AACzD,+CAAoD;AACpD,+CAAqD;AACrD,iDAAsD;AACtD,iDAAuD;AACvD,2DAA0D;AAC1D,iEAAgE;AAChE,mDAAyD;AACzD,2DAAiE;AACjE,6DAAmE;AACnE,uDAA6D;AAC7D,mDAA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E,CAAgC,CAAC;IACrF,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;QAC5C,OAAO,uBAAC,kEAAoC,IAAkB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAtC,OAAO,CAAC,EAAE,CAAgC,CAAC;IAC/F,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACzC,OAAO,uBAAC,4DAAiC,IAAkB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAtC,OAAO,CAAC,EAAE,CAAgC,CAAC;IAC5F,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAzFW,QAAA,aAAa,iBAyFxB"}
1
+ {"version":3,"file":"renderElement.js","sourceRoot":"","sources":["../../../../../src/UI/Pages/ComposableScreen/elements/renderElement.tsx"],"names":[],"mappings":";;;;AACA,+EAAsE;AAItE,iDAAuD;AACvD,+CAAqD;AACrD,iDAAuD;AACvD,mDAAyD;AACzD,+CAAoD;AACpD,+CAAqD;AACrD,iDAAsD;AACtD,iDAAuD;AACvD,2DAA0D;AAC1D,iEAAgE;AAChE,mDAAyD;AACzD,2DAAiE;AACjE,6DAAmE;AACnE,uDAA6D;AAC7D,mDAAyD;AACzD,+DAAqE;AACrE,2DAAiE;AACjE,+EAAqF;AACrF,yEAA+E;AAC/E,+CAA4C;AAErC,MAAM,aAAa,GAAG,CAC3B,OAAkB,EAClB,GAAkB,EAClB,UAA2C,EAC1B,EAAE;IACnB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CACjC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,KAAK,CAAC,C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IAAtC,OAAO,CAAC,EAAE,CAAgC,CAAC;QAC5F,CAAC;QAEC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,EAAE,CAAC;IAEL,gFAAgF;IAChF,wEAAwE;IACxE,0EAA0E;IAC1E,0EAA0E;IAC1E,MAAM,CAAC,GAAG,OAAO,CAAC,KAAqB,CAAC;IACxC,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;QAClD,OAAO,CACL,uBAAC,yBAAW,IAEV,SAAS,EAAE,CAAC,CAAC,SAAS,EACtB,SAAS,EAAE,CAAC,CAAC,SAAS,EACtB,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,SAAS,EAAE,CAAC,CAAC,SAAS,YAErB,IAAI,IANA,OAAO,CAAC,EAAE,CAOH,CACf,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAlHW,QAAA,aAAa,iBAkHxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocapine/react-native-onboarding-ui",
3
- "version": "1.30.0",
3
+ "version": "1.32.0",
4
4
  "description": "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",
@@ -0,0 +1,133 @@
1
+ import React, { useEffect, useMemo } from "react";
2
+ import Animated, {
3
+ useSharedValue,
4
+ useAnimatedStyle,
5
+ withTiming,
6
+ withRepeat,
7
+ withDelay,
8
+ cancelAnimation,
9
+ interpolate,
10
+ } from "react-native-reanimated";
11
+ import type { ElementAnimation, ElementTransform } from "@rocapine/react-native-onboarding";
12
+ import { buildEntering, buildExiting, buildLayout, EASING_MAP } from "./buildAnimation";
13
+
14
+ type Props = {
15
+ animation?: ElementAnimation;
16
+ transform?: ElementTransform;
17
+ // Layout props forwarded from the child so the extra wrapper stays
18
+ // layout-transparent (a trapped `flex`/`alignSelf` would otherwise break
19
+ // the child's relationship to its parent).
20
+ flex?: number;
21
+ alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
22
+ children: React.ReactNode;
23
+ };
24
+
25
+ // Build the static transform array (RN expects `[{translateX}, {scale}, ...]`).
26
+ // Typed `any[]`: RN's transform element is a strict per-key union that a
27
+ // programmatically-built array can't satisfy structurally, and the array is
28
+ // composed with animated entries inside the worklet below.
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ const buildStaticTransform = (t?: ElementTransform): any[] => {
31
+ if (!t) return [];
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ const arr: any[] = [];
34
+ if (t.translateX != null) arr.push({ translateX: t.translateX });
35
+ if (t.translateY != null) arr.push({ translateY: t.translateY });
36
+ if (t.scale != null) arr.push({ scale: t.scale });
37
+ if (t.scaleX != null) arr.push({ scaleX: t.scaleX });
38
+ if (t.scaleY != null) arr.push({ scaleY: t.scaleY });
39
+ if (t.rotate != null) arr.push({ rotate: `${t.rotate}deg` });
40
+ return arr;
41
+ };
42
+
43
+ /**
44
+ * Wraps a rendered UIElement in an `Animated.View` that owns its
45
+ * entering/exiting/layout transitions (reanimated builders) and a continuous
46
+ * `effect` (imperative `withRepeat`), plus any static `transform`.
47
+ *
48
+ * Injected by `renderElement` only when `animation` or `transform` is present.
49
+ * All reanimated hooks are called unconditionally (rules of hooks) — the
50
+ * effect-vs-no-effect branch lives inside the effect/worklet body.
51
+ */
52
+ export const AnimatedBox = ({
53
+ animation,
54
+ transform,
55
+ flex,
56
+ alignSelf,
57
+ children,
58
+ }: Props): React.ReactElement => {
59
+ const entering = buildEntering(animation?.entering);
60
+ const exiting = buildExiting(animation?.exiting);
61
+ const layout = buildLayout(animation?.layout);
62
+
63
+ const effect = animation?.effect;
64
+ const staticTransform = useMemo(() => buildStaticTransform(transform), [transform]);
65
+
66
+ // Continuous-effect driver (0 -> 1). Created unconditionally.
67
+ const driver = useSharedValue(0);
68
+
69
+ useEffect(() => {
70
+ if (!effect) {
71
+ cancelAnimation(driver);
72
+ driver.value = 0;
73
+ return;
74
+ }
75
+ driver.value = 0;
76
+ // rotate spins one direction; the rest breathe back and forth.
77
+ const reverse = effect.preset !== "rotate";
78
+ const half = withTiming(1, {
79
+ duration: effect.duration ?? 1000,
80
+ easing: EASING_MAP[effect.easing ?? "ease-in-out"],
81
+ });
82
+ const repeated = withRepeat(half, effect.loop === false ? 1 : -1, reverse);
83
+ driver.value = effect.delay ? withDelay(effect.delay, repeated) : repeated;
84
+ return () => cancelAnimation(driver);
85
+ }, [effect, driver]);
86
+
87
+ const animatedStyle = useAnimatedStyle(() => {
88
+ if (!effect) return { transform: staticTransform };
89
+ switch (effect.preset) {
90
+ case "pulse":
91
+ return {
92
+ transform: [
93
+ ...staticTransform,
94
+ { scale: interpolate(driver.value, [0, 1], [effect.minScale ?? 0.95, effect.maxScale ?? 1.05]) },
95
+ ],
96
+ };
97
+ case "fade":
98
+ return {
99
+ transform: staticTransform,
100
+ opacity: interpolate(driver.value, [0, 1], [effect.minOpacity ?? 0.4, 1]),
101
+ };
102
+ case "rotate":
103
+ return {
104
+ transform: [
105
+ ...staticTransform,
106
+ { rotate: `${interpolate(driver.value, [0, 1], [0, effect.degrees ?? 360])}deg` },
107
+ ],
108
+ };
109
+ case "bounce":
110
+ return {
111
+ transform: [...staticTransform, { translateY: interpolate(driver.value, [0, 1], [0, -10]) }],
112
+ };
113
+ case "shimmer":
114
+ return {
115
+ transform: staticTransform,
116
+ opacity: interpolate(driver.value, [0, 1], [0.5, 1]),
117
+ };
118
+ default:
119
+ return { transform: staticTransform };
120
+ }
121
+ }, [effect, staticTransform]);
122
+
123
+ return (
124
+ <Animated.View
125
+ entering={entering}
126
+ exiting={exiting}
127
+ layout={layout}
128
+ style={[{ flex, alignSelf }, animatedStyle]}
129
+ >
130
+ {children}
131
+ </Animated.View>
132
+ );
133
+ };
@@ -50,6 +50,213 @@ export const ShadowOffsetSchema = z.object({
50
50
  height: z.number(),
51
51
  });
52
52
 
53
+ // ---------------------------------------------------------------------------
54
+ // Animation / Transform surface
55
+ //
56
+ // Schema stays intentionally close to react-native-reanimated: `preset` values
57
+ // are the *exact* reanimated builder names (e.g. `FadeInDown`, `SlideOutLeft`,
58
+ // `LinearTransition`), so the UI renderer resolves them by direct namespace
59
+ // lookup (`Reanimated[preset]`) rather than a translation table. Modifier fields
60
+ // (`duration`/`delay`/`spring`/`easing`) map to reanimated builder methods
61
+ // (`.duration().delay().springify().easing()`).
62
+ // ---------------------------------------------------------------------------
63
+
64
+ // Reuses the easing-name convention from ProgressIndicatorElement.
65
+ export type AnimationEasing = "linear" | "ease-in" | "ease-out" | "ease-in-out";
66
+
67
+ const AnimationEasingSchema = z.enum(["linear", "ease-in", "ease-out", "ease-in-out"]);
68
+
69
+ // Mirrors reanimated's `.springify(config)` — only the fields it accepts.
70
+ // When `spring` is present it wins over `easing` (matches reanimated semantics).
71
+ export type SpringConfig = {
72
+ damping?: number;
73
+ stiffness?: number;
74
+ mass?: number;
75
+ };
76
+
77
+ const SpringConfigSchema = z.object({
78
+ damping: z.number().positive().optional(),
79
+ stiffness: z.number().positive().optional(),
80
+ mass: z.number().positive().optional(),
81
+ });
82
+
83
+ // Exact reanimated entering builder names.
84
+ export type EnteringPreset =
85
+ | "FadeIn" | "FadeInUp" | "FadeInDown" | "FadeInLeft" | "FadeInRight"
86
+ | "SlideInUp" | "SlideInDown" | "SlideInLeft" | "SlideInRight"
87
+ | "ZoomIn" | "ZoomInRotate" | "ZoomInUp" | "ZoomInDown" | "ZoomInLeft" | "ZoomInRight"
88
+ | "ZoomInEasyUp" | "ZoomInEasyDown"
89
+ | "BounceIn" | "BounceInUp" | "BounceInDown" | "BounceInLeft" | "BounceInRight"
90
+ | "FlipInXUp" | "FlipInYLeft" | "FlipInXDown" | "FlipInYRight" | "FlipInEasyX" | "FlipInEasyY"
91
+ | "StretchInX" | "StretchInY"
92
+ | "RotateInDownLeft" | "RotateInDownRight" | "RotateInUpLeft" | "RotateInUpRight"
93
+ | "RollInLeft" | "RollInRight"
94
+ | "PinwheelIn"
95
+ | "LightSpeedInLeft" | "LightSpeedInRight";
96
+
97
+ const EnteringPresetSchema = z.enum([
98
+ "FadeIn", "FadeInUp", "FadeInDown", "FadeInLeft", "FadeInRight",
99
+ "SlideInUp", "SlideInDown", "SlideInLeft", "SlideInRight",
100
+ "ZoomIn", "ZoomInRotate", "ZoomInUp", "ZoomInDown", "ZoomInLeft", "ZoomInRight",
101
+ "ZoomInEasyUp", "ZoomInEasyDown",
102
+ "BounceIn", "BounceInUp", "BounceInDown", "BounceInLeft", "BounceInRight",
103
+ "FlipInXUp", "FlipInYLeft", "FlipInXDown", "FlipInYRight", "FlipInEasyX", "FlipInEasyY",
104
+ "StretchInX", "StretchInY",
105
+ "RotateInDownLeft", "RotateInDownRight", "RotateInUpLeft", "RotateInUpRight",
106
+ "RollInLeft", "RollInRight",
107
+ "PinwheelIn",
108
+ "LightSpeedInLeft", "LightSpeedInRight",
109
+ ]);
110
+
111
+ // Exact reanimated exiting builder names.
112
+ export type ExitingPreset =
113
+ | "FadeOut" | "FadeOutUp" | "FadeOutDown" | "FadeOutLeft" | "FadeOutRight"
114
+ | "SlideOutUp" | "SlideOutDown" | "SlideOutLeft" | "SlideOutRight"
115
+ | "ZoomOut" | "ZoomOutRotate" | "ZoomOutUp" | "ZoomOutDown" | "ZoomOutLeft" | "ZoomOutRight"
116
+ | "ZoomOutEasyUp" | "ZoomOutEasyDown"
117
+ | "BounceOut" | "BounceOutUp" | "BounceOutDown" | "BounceOutLeft" | "BounceOutRight"
118
+ | "FlipOutXUp" | "FlipOutYLeft" | "FlipOutXDown" | "FlipOutYRight" | "FlipOutEasyX" | "FlipOutEasyY"
119
+ | "StretchOutX" | "StretchOutY"
120
+ | "RotateOutDownLeft" | "RotateOutDownRight" | "RotateOutUpLeft" | "RotateOutUpRight"
121
+ | "RollOutLeft" | "RollOutRight"
122
+ | "PinwheelOut"
123
+ | "LightSpeedOutLeft" | "LightSpeedOutRight";
124
+
125
+ const ExitingPresetSchema = z.enum([
126
+ "FadeOut", "FadeOutUp", "FadeOutDown", "FadeOutLeft", "FadeOutRight",
127
+ "SlideOutUp", "SlideOutDown", "SlideOutLeft", "SlideOutRight",
128
+ "ZoomOut", "ZoomOutRotate", "ZoomOutUp", "ZoomOutDown", "ZoomOutLeft", "ZoomOutRight",
129
+ "ZoomOutEasyUp", "ZoomOutEasyDown",
130
+ "BounceOut", "BounceOutUp", "BounceOutDown", "BounceOutLeft", "BounceOutRight",
131
+ "FlipOutXUp", "FlipOutYLeft", "FlipOutXDown", "FlipOutYRight", "FlipOutEasyX", "FlipOutEasyY",
132
+ "StretchOutX", "StretchOutY",
133
+ "RotateOutDownLeft", "RotateOutDownRight", "RotateOutUpLeft", "RotateOutUpRight",
134
+ "RollOutLeft", "RollOutRight",
135
+ "PinwheelOut",
136
+ "LightSpeedOutLeft", "LightSpeedOutRight",
137
+ ]);
138
+
139
+ // Exact reanimated layout-transition builder names.
140
+ export type LayoutPreset =
141
+ | "LinearTransition" | "FadingTransition" | "SequencedTransition"
142
+ | "JumpingTransition" | "CurvedTransition" | "EntryExitTransition";
143
+
144
+ const LayoutPresetSchema = z.enum([
145
+ "LinearTransition", "FadingTransition", "SequencedTransition",
146
+ "JumpingTransition", "CurvedTransition", "EntryExitTransition",
147
+ ]);
148
+
149
+ export type EnteringAnimation = {
150
+ preset: EnteringPreset;
151
+ duration?: number;
152
+ delay?: number;
153
+ easing?: AnimationEasing;
154
+ spring?: SpringConfig;
155
+ };
156
+
157
+ const EnteringAnimationSchema = z.object({
158
+ preset: EnteringPresetSchema,
159
+ duration: z.number().min(0).optional(),
160
+ delay: z.number().min(0).optional(),
161
+ easing: AnimationEasingSchema.optional(),
162
+ spring: SpringConfigSchema.optional(),
163
+ });
164
+
165
+ export type ExitingAnimation = {
166
+ preset: ExitingPreset;
167
+ duration?: number;
168
+ delay?: number;
169
+ easing?: AnimationEasing;
170
+ spring?: SpringConfig;
171
+ };
172
+
173
+ const ExitingAnimationSchema = z.object({
174
+ preset: ExitingPresetSchema,
175
+ duration: z.number().min(0).optional(),
176
+ delay: z.number().min(0).optional(),
177
+ easing: AnimationEasingSchema.optional(),
178
+ spring: SpringConfigSchema.optional(),
179
+ });
180
+
181
+ export type LayoutAnimation = {
182
+ preset: LayoutPreset;
183
+ duration?: number;
184
+ spring?: SpringConfig;
185
+ };
186
+
187
+ const LayoutAnimationSchema = z.object({
188
+ preset: LayoutPresetSchema,
189
+ duration: z.number().min(0).optional(),
190
+ spring: SpringConfigSchema.optional(),
191
+ });
192
+
193
+ // Continuous looping effects — the one piece not named after a reanimated
194
+ // builder. Rendered imperatively with `withRepeat` over `withTiming`.
195
+ export type EffectPreset = "pulse" | "fade" | "rotate" | "shimmer" | "bounce";
196
+
197
+ const EffectPresetSchema = z.enum(["pulse", "fade", "rotate", "shimmer", "bounce"]);
198
+
199
+ export type ElementEffect = {
200
+ preset: EffectPreset;
201
+ duration?: number;
202
+ delay?: number;
203
+ easing?: AnimationEasing;
204
+ loop?: boolean;
205
+ /** pulse: scale bounds (default 0.95 / 1.05). */
206
+ minScale?: number;
207
+ maxScale?: number;
208
+ /** fade: lower opacity bound (default 0.4). */
209
+ minOpacity?: number;
210
+ /** rotate: sweep in degrees (default 360). */
211
+ degrees?: number;
212
+ };
213
+
214
+ const EffectSchema = z.object({
215
+ preset: EffectPresetSchema,
216
+ duration: z.number().min(0).optional(),
217
+ delay: z.number().min(0).optional(),
218
+ easing: AnimationEasingSchema.optional(),
219
+ loop: z.boolean().optional(),
220
+ minScale: z.number().positive().optional(),
221
+ maxScale: z.number().positive().optional(),
222
+ minOpacity: z.number().min(0).max(1).optional(),
223
+ degrees: z.number().optional(),
224
+ });
225
+
226
+ export type ElementAnimation = {
227
+ entering?: EnteringAnimation;
228
+ exiting?: ExitingAnimation;
229
+ layout?: LayoutAnimation;
230
+ effect?: ElementEffect;
231
+ };
232
+
233
+ const ElementAnimationSchema = z.object({
234
+ entering: EnteringAnimationSchema.optional(),
235
+ exiting: ExitingAnimationSchema.optional(),
236
+ layout: LayoutAnimationSchema.optional(),
237
+ effect: EffectSchema.optional(),
238
+ });
239
+
240
+ // Static transform surface — also what `effect` animates at runtime.
241
+ export type ElementTransform = {
242
+ translateX?: number;
243
+ translateY?: number;
244
+ scale?: number;
245
+ scaleX?: number;
246
+ scaleY?: number;
247
+ /** degrees */
248
+ rotate?: number;
249
+ };
250
+
251
+ const TransformSchema = z.object({
252
+ translateX: z.number().optional(),
253
+ translateY: z.number().optional(),
254
+ scale: z.number().optional(),
255
+ scaleX: z.number().optional(),
256
+ scaleY: z.number().optional(),
257
+ rotate: z.number().optional(),
258
+ });
259
+
53
260
  export type BaseBoxProps = {
54
261
  width?: number | string;
55
262
  height?: number | string;
@@ -80,6 +287,8 @@ export type BaseBoxProps = {
80
287
  shadowOpacity?: number;
81
288
  shadowRadius?: number;
82
289
  elevation?: number;
290
+ transform?: ElementTransform;
291
+ animation?: ElementAnimation;
83
292
  };
84
293
 
85
294
  export const BaseBoxPropsSchema = z.object({
@@ -112,4 +321,6 @@ export const BaseBoxPropsSchema = z.object({
112
321
  shadowOpacity: z.number().min(0).max(1).optional(),
113
322
  shadowRadius: z.number().min(0).optional(),
114
323
  elevation: z.number().min(0).optional(),
324
+ transform: TransformSchema.optional(),
325
+ animation: ElementAnimationSchema.optional(),
115
326
  });
@@ -10,13 +10,13 @@ import Animated, {
10
10
  withRepeat,
11
11
  withDelay,
12
12
  runOnJS,
13
- Easing,
14
13
  cancelAnimation,
15
14
  } from "react-native-reanimated";
16
15
  import Svg, { Circle } from "react-native-svg";
17
16
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
18
17
  import { UIElement } from "../types";
19
18
  import { RenderContext, dim } from "./shared";
19
+ import { EASING_MAP } from "./buildAnimation";
20
20
 
21
21
  export type ProgressEasing = "linear" | "ease-in" | "ease-out" | "ease-in-out";
22
22
 
@@ -60,14 +60,6 @@ export const ProgressIndicatorElementPropsSchema = BaseBoxPropsSchema.extend({
60
60
 
61
61
  const AnimatedCircle = Animated.createAnimatedComponent(Circle);
62
62
 
63
- // CSS-style cubic-bezier curves matching the selectable easing names.
64
- const EASING_MAP: Record<ProgressEasing, ReturnType<typeof Easing.bezier> | typeof Easing.linear> = {
65
- linear: Easing.linear,
66
- "ease-in": Easing.bezier(0.42, 0, 1, 1),
67
- "ease-out": Easing.bezier(0, 0, 0.58, 1),
68
- "ease-in-out": Easing.bezier(0.42, 0, 0.58, 1),
69
- };
70
-
71
63
  const clamp = (n: number): number => Math.max(0, Math.min(100, n));
72
64
 
73
65
  type ProgressUIElement = Extract<UIElement, { type: "ProgressIndicator" }>;