@rocapine/react-native-onboarding 1.55.0 → 1.56.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/onboarding-example.d.ts +224 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +17 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +52 -0
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +11 -11
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.d.ts +402 -0
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.d.ts.map +1 -0
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.js +28 -0
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.js.map +1 -0
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts +18 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.js +5 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.js.map +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +8 -0
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.js +8 -0
- package/dist/steps/ComposableScreen/types.js.map +1 -1
- package/package.json +1 -1
- package/src/onboarding-example.ts +17 -0
- package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +3 -3
- package/src/steps/ComposableScreen/elements/TypewriterTextElement.ts +89 -0
- package/src/steps/ComposableScreen/elements/ZStackElement.ts +8 -2
- package/src/steps/ComposableScreen/types.ts +16 -0
|
@@ -324,6 +324,23 @@ export const onboardingExample = {
|
|
|
324
324
|
marginVertical: 4,
|
|
325
325
|
},
|
|
326
326
|
},
|
|
327
|
+
{
|
|
328
|
+
// TypewriterText: reveals the headline one character at a time,
|
|
329
|
+
// each char a staggered FadeInDown entering animation.
|
|
330
|
+
id: "typewriter-headline",
|
|
331
|
+
type: "TypewriterText",
|
|
332
|
+
props: {
|
|
333
|
+
content: "Welcome to your journey",
|
|
334
|
+
preset: "FadeInDown",
|
|
335
|
+
duration: 400,
|
|
336
|
+
stagger: 45,
|
|
337
|
+
easing: "ease-out",
|
|
338
|
+
fontSize: 24,
|
|
339
|
+
fontWeight: "700",
|
|
340
|
+
textAlign: "center",
|
|
341
|
+
marginVertical: 8,
|
|
342
|
+
},
|
|
343
|
+
},
|
|
327
344
|
{
|
|
328
345
|
id: "hero-video",
|
|
329
346
|
type: "Video",
|
|
@@ -80,7 +80,7 @@ export const ShadowOffsetSchema = z.object({
|
|
|
80
80
|
// Reuses the easing-name convention from ProgressIndicatorElement.
|
|
81
81
|
export type AnimationEasing = "linear" | "ease-in" | "ease-out" | "ease-in-out";
|
|
82
82
|
|
|
83
|
-
const AnimationEasingSchema = z.enum(["linear", "ease-in", "ease-out", "ease-in-out"]);
|
|
83
|
+
export const AnimationEasingSchema = z.enum(["linear", "ease-in", "ease-out", "ease-in-out"]);
|
|
84
84
|
|
|
85
85
|
// Mirrors reanimated's `.springify(config)` — only the fields it accepts.
|
|
86
86
|
// When `spring` is present it wins over `easing` (matches reanimated semantics).
|
|
@@ -90,7 +90,7 @@ export type SpringConfig = {
|
|
|
90
90
|
mass?: number;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
const SpringConfigSchema = z.object({
|
|
93
|
+
export const SpringConfigSchema = z.object({
|
|
94
94
|
damping: z.number().positive().optional(),
|
|
95
95
|
stiffness: z.number().positive().optional(),
|
|
96
96
|
mass: z.number().positive().optional(),
|
|
@@ -110,7 +110,7 @@ export type EnteringPreset =
|
|
|
110
110
|
| "PinwheelIn"
|
|
111
111
|
| "LightSpeedInLeft" | "LightSpeedInRight";
|
|
112
112
|
|
|
113
|
-
const EnteringPresetSchema = z.enum([
|
|
113
|
+
export const EnteringPresetSchema = z.enum([
|
|
114
114
|
"FadeIn", "FadeInUp", "FadeInDown", "FadeInLeft", "FadeInRight",
|
|
115
115
|
"SlideInUp", "SlideInDown", "SlideInLeft", "SlideInRight",
|
|
116
116
|
"ZoomIn", "ZoomInRotate", "ZoomInUp", "ZoomInDown", "ZoomInLeft", "ZoomInRight",
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
BaseBoxProps,
|
|
4
|
+
BaseBoxPropsSchema,
|
|
5
|
+
type AnimationEasing,
|
|
6
|
+
type EnteringPreset,
|
|
7
|
+
type SpringConfig,
|
|
8
|
+
AnimationEasingSchema,
|
|
9
|
+
EnteringPresetSchema,
|
|
10
|
+
SpringConfigSchema,
|
|
11
|
+
} from "./BaseBoxProps";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Reveals its text content **one character at a time** with a staggered
|
|
15
|
+
* entering animation — the classic typewriter / staggered-headline effect.
|
|
16
|
+
*
|
|
17
|
+
* Each character mounts its own reanimated entering animation; the per-character
|
|
18
|
+
* `delay` is `delay + charIndex * stagger`, so characters appear in sequence.
|
|
19
|
+
* This is distinct from the whole-block `animation.entering` every element
|
|
20
|
+
* already gets via `BaseBoxProps` (which fades the *entire* string at once), and
|
|
21
|
+
* from `AnimatedText` (an animated number counter).
|
|
22
|
+
*
|
|
23
|
+
* `preset`/`duration`/`delay`/`easing`/`spring` map 1:1 to the reanimated
|
|
24
|
+
* entering-builder modifiers, exactly like `BaseBoxProps.animation.entering`.
|
|
25
|
+
* `stagger` is the typewriter knob — the gap (ms) between consecutive characters.
|
|
26
|
+
*/
|
|
27
|
+
export type TypewriterTextElementProps = BaseBoxProps & {
|
|
28
|
+
/**
|
|
29
|
+
* The text to reveal. In `expression` mode `{{variable}}` interpolation runs
|
|
30
|
+
* before the string is split into characters. Plain string only (no spans).
|
|
31
|
+
*/
|
|
32
|
+
content: string;
|
|
33
|
+
mode?: "plain" | "expression";
|
|
34
|
+
/** Reanimated entering builder applied per character. Default `"FadeInDown"`. */
|
|
35
|
+
preset?: EnteringPreset;
|
|
36
|
+
/** Per-character animation length in ms (reanimated `.duration()`). Default 400. */
|
|
37
|
+
duration?: number;
|
|
38
|
+
/** Lead-in delay (ms) before the first character animates. Default 0. */
|
|
39
|
+
delay?: number;
|
|
40
|
+
/** Gap in ms between consecutive characters — the stagger step. Default 45. */
|
|
41
|
+
stagger?: number;
|
|
42
|
+
/** Easing for the per-character animation. Ignored when `spring` is set. */
|
|
43
|
+
easing?: AnimationEasing;
|
|
44
|
+
/** Spring config (reanimated `.springify()`); wins over `easing` when present. */
|
|
45
|
+
spring?: SpringConfig;
|
|
46
|
+
/** Replay the reveal on a loop (remounts the characters each cycle). Default false. */
|
|
47
|
+
loop?: boolean;
|
|
48
|
+
/** Pause in ms between loop cycles (only when `loop`). Default 1200. */
|
|
49
|
+
loopDelay?: number;
|
|
50
|
+
/** Show a blinking typewriter caret after the text. Default false. */
|
|
51
|
+
cursor?: boolean;
|
|
52
|
+
/** Caret glyph when `cursor` is on. Default "|". */
|
|
53
|
+
cursorChar?: string;
|
|
54
|
+
fontSize?: number;
|
|
55
|
+
fontWeight?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Font family name. Omit or set to `"inherit"` to inherit from
|
|
58
|
+
* `theme.typography.defaultFontFamily`.
|
|
59
|
+
*/
|
|
60
|
+
fontFamily?: string | "inherit";
|
|
61
|
+
fontStyle?: "normal" | "italic";
|
|
62
|
+
color?: string;
|
|
63
|
+
textAlign?: "left" | "center" | "right";
|
|
64
|
+
letterSpacing?: number;
|
|
65
|
+
lineHeight?: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const TypewriterTextElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
69
|
+
content: z.string(),
|
|
70
|
+
mode: z.enum(["plain", "expression"]).optional(),
|
|
71
|
+
preset: EnteringPresetSchema.optional(),
|
|
72
|
+
duration: z.number().min(0).optional(),
|
|
73
|
+
delay: z.number().min(0).optional(),
|
|
74
|
+
stagger: z.number().min(0).optional(),
|
|
75
|
+
easing: AnimationEasingSchema.optional(),
|
|
76
|
+
spring: SpringConfigSchema.optional(),
|
|
77
|
+
loop: z.boolean().optional(),
|
|
78
|
+
loopDelay: z.number().min(0).optional(),
|
|
79
|
+
cursor: z.boolean().optional(),
|
|
80
|
+
cursorChar: z.string().optional(),
|
|
81
|
+
fontSize: z.number().optional(),
|
|
82
|
+
fontWeight: z.string().optional(),
|
|
83
|
+
fontFamily: z.string().optional(),
|
|
84
|
+
fontStyle: z.enum(["normal", "italic"]).optional(),
|
|
85
|
+
color: z.string().optional(),
|
|
86
|
+
textAlign: z.enum(["left", "center", "right"]).optional(),
|
|
87
|
+
letterSpacing: z.number().optional(),
|
|
88
|
+
lineHeight: z.number().optional(),
|
|
89
|
+
});
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
3
3
|
|
|
4
|
-
export type ZStackElementProps = BaseBoxProps
|
|
4
|
+
export type ZStackElementProps = BaseBoxProps & {
|
|
5
|
+
justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
|
|
6
|
+
alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
7
|
+
};
|
|
5
8
|
|
|
6
|
-
export const ZStackElementPropsSchema = BaseBoxPropsSchema
|
|
9
|
+
export const ZStackElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
10
|
+
justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
|
|
11
|
+
alignItems: z.enum(["flex-start", "center", "flex-end", "stretch", "baseline"]).optional(),
|
|
12
|
+
});
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
} from "./elements/KeyboardAvoidingViewElement";
|
|
35
35
|
import { type ProgressIndicatorElementProps, ProgressIndicatorElementPropsSchema } from "./elements/ProgressIndicatorElement";
|
|
36
36
|
import { type AnimatedTextElementProps, AnimatedTextElementPropsSchema } from "./elements/AnimatedTextElement";
|
|
37
|
+
import { type TypewriterTextElementProps, TypewriterTextElementPropsSchema } from "./elements/TypewriterTextElement";
|
|
37
38
|
import { type DrawingPadElementProps, DrawingPadElementPropsSchema } from "./elements/DrawingPadElement";
|
|
38
39
|
import { type SliderElementProps, SliderElementPropsSchema } from "./elements/SliderElement";
|
|
39
40
|
|
|
@@ -88,6 +89,7 @@ export type {
|
|
|
88
89
|
} from "./elements/KeyboardAvoidingViewElement";
|
|
89
90
|
export type { ProgressIndicatorElementProps, ProgressEasing } from "./elements/ProgressIndicatorElement";
|
|
90
91
|
export type { AnimatedTextElementProps } from "./elements/AnimatedTextElement";
|
|
92
|
+
export type { TypewriterTextElementProps } from "./elements/TypewriterTextElement";
|
|
91
93
|
export type { DrawingPadElementProps } from "./elements/DrawingPadElement";
|
|
92
94
|
export type { SliderElementProps } from "./elements/SliderElement";
|
|
93
95
|
|
|
@@ -272,6 +274,13 @@ type UIElement =
|
|
|
272
274
|
type: "AnimatedText";
|
|
273
275
|
props: AnimatedTextElementProps;
|
|
274
276
|
}
|
|
277
|
+
| {
|
|
278
|
+
id: string;
|
|
279
|
+
name?: string;
|
|
280
|
+
renderWhen?: LeafCondition | ConditionGroup;
|
|
281
|
+
type: "TypewriterText";
|
|
282
|
+
props: TypewriterTextElementProps;
|
|
283
|
+
}
|
|
275
284
|
| {
|
|
276
285
|
id: string;
|
|
277
286
|
name?: string;
|
|
@@ -455,6 +464,13 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
|
|
|
455
464
|
type: z.literal("AnimatedText"),
|
|
456
465
|
props: AnimatedTextElementPropsSchema,
|
|
457
466
|
}),
|
|
467
|
+
z.object({
|
|
468
|
+
id: z.string(),
|
|
469
|
+
name: z.string().optional(),
|
|
470
|
+
renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
|
|
471
|
+
type: z.literal("TypewriterText"),
|
|
472
|
+
props: TypewriterTextElementPropsSchema,
|
|
473
|
+
}),
|
|
458
474
|
z.object({
|
|
459
475
|
id: z.string(),
|
|
460
476
|
name: z.string().optional(),
|