@rocapine/react-native-onboarding 1.24.0 → 1.25.1

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 (54) hide show
  1. package/dist/onboarding-example.d.ts +314 -166
  2. package/dist/onboarding-example.d.ts.map +1 -1
  3. package/dist/onboarding-example.js +97 -10
  4. package/dist/onboarding-example.js.map +1 -1
  5. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +2 -0
  6. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
  7. package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +1 -0
  8. package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
  9. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +4 -0
  10. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
  11. package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts +1 -0
  12. package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
  13. package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts +1 -0
  14. package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
  15. package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts +1 -0
  16. package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
  17. package/dist/steps/ComposableScreen/elements/IconElement.d.ts +1 -0
  18. package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +1 -1
  19. package/dist/steps/ComposableScreen/elements/InputElement.d.ts +1 -0
  20. package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +1 -1
  21. package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts +87 -0
  22. package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +1 -0
  23. package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.js +11 -0
  24. package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.js.map +1 -0
  25. package/dist/steps/ComposableScreen/elements/LottieElement.d.ts +1 -0
  26. package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
  27. package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts +1 -0
  28. package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
  29. package/dist/steps/ComposableScreen/elements/RiveElement.d.ts +1 -0
  30. package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
  31. package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts +1 -0
  32. package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +1 -1
  33. package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts +109 -0
  34. package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts.map +1 -0
  35. package/dist/steps/ComposableScreen/elements/ScrollViewElement.js +23 -0
  36. package/dist/steps/ComposableScreen/elements/ScrollViewElement.js.map +1 -0
  37. package/dist/steps/ComposableScreen/elements/StackElement.d.ts +1 -0
  38. package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +1 -1
  39. package/dist/steps/ComposableScreen/elements/TextElement.d.ts +1 -0
  40. package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +1 -1
  41. package/dist/steps/ComposableScreen/elements/VideoElement.d.ts +1 -0
  42. package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
  43. package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts +1 -0
  44. package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +1 -1
  45. package/dist/steps/ComposableScreen/types.d.ts +18 -0
  46. package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
  47. package/dist/steps/ComposableScreen/types.js +52 -1
  48. package/dist/steps/ComposableScreen/types.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/onboarding-example.ts +97 -10
  51. package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +2 -0
  52. package/src/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.ts +16 -0
  53. package/src/steps/ComposableScreen/elements/ScrollViewElement.ts +40 -0
  54. package/src/steps/ComposableScreen/types.ts +84 -3
@@ -21,6 +21,11 @@ import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./ele
21
21
  import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
22
22
  import { type ZStackElementProps, ZStackElementPropsSchema } from "./elements/ZStackElement";
23
23
  import { type SafeAreaViewElementProps, SafeAreaViewElementPropsSchema } from "./elements/SafeAreaViewElement";
24
+ import { type ScrollViewElementProps, ScrollViewElementPropsSchema } from "./elements/ScrollViewElement";
25
+ import {
26
+ type KeyboardAvoidingViewElementProps,
27
+ KeyboardAvoidingViewElementPropsSchema,
28
+ } from "./elements/KeyboardAvoidingViewElement";
24
29
 
25
30
  export type { BaseBoxProps, GradientBackground, GradientEdge, GradientStop, LinearGradientConfig } from "./elements/BaseBoxProps";
26
31
  export { BaseBoxPropsSchema, GradientBackgroundSchema } from "./elements/BaseBoxProps";
@@ -40,6 +45,11 @@ export type { DatePickerElementProps } from "./elements/DatePickerElement";
40
45
  export type { CarouselElementProps } from "./elements/CarouselElement";
41
46
  export type { ZStackElementProps } from "./elements/ZStackElement";
42
47
  export type { SafeAreaViewElementProps, SafeAreaEdge, SafeAreaEdgeMode } from "./elements/SafeAreaViewElement";
48
+ export type { ScrollViewElementProps, ScrollViewContentInset } from "./elements/ScrollViewElement";
49
+ export type {
50
+ KeyboardAvoidingViewElementProps,
51
+ KeyboardAvoidingBehavior,
52
+ } from "./elements/KeyboardAvoidingViewElement";
43
53
 
44
54
  /**
45
55
  * Type tag for a ComposableScreen variable. Drives expression-mode coercion
@@ -169,6 +179,22 @@ type UIElement =
169
179
  type: "SafeAreaView";
170
180
  props: SafeAreaViewElementProps;
171
181
  children: UIElement[];
182
+ }
183
+ | {
184
+ id: string;
185
+ name?: string;
186
+ renderWhen?: LeafCondition | ConditionGroup;
187
+ type: "ScrollView";
188
+ props: ScrollViewElementProps;
189
+ children: UIElement[];
190
+ }
191
+ | {
192
+ id: string;
193
+ name?: string;
194
+ renderWhen?: LeafCondition | ConditionGroup;
195
+ type: "KeyboardAvoidingView";
196
+ props: KeyboardAvoidingViewElementProps;
197
+ children: UIElement[];
172
198
  };
173
199
 
174
200
  const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
@@ -282,12 +308,67 @@ const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
282
308
  props: SafeAreaViewElementPropsSchema,
283
309
  children: z.array(UIElementSchema),
284
310
  }),
311
+ z.object({
312
+ id: z.string(),
313
+ name: z.string().optional(),
314
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
315
+ type: z.literal("ScrollView"),
316
+ props: ScrollViewElementPropsSchema,
317
+ children: z.array(UIElementSchema),
318
+ }),
319
+ z.object({
320
+ id: z.string(),
321
+ name: z.string().optional(),
322
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
323
+ type: z.literal("KeyboardAvoidingView"),
324
+ props: KeyboardAvoidingViewElementPropsSchema,
325
+ children: z.array(UIElementSchema),
326
+ }),
285
327
  ])
286
328
  );
287
329
 
288
- export const ComposableScreenStepPayloadSchema = z.object({
289
- elements: z.array(UIElementSchema),
290
- });
330
+ // Walk a UIElement tree; flag any KeyboardAvoidingView descendant of another KeyboardAvoidingView.
331
+ // RN behavior is undefined when a KAV nests another; KAV adjusts the layout of the host view, and
332
+ // stacking adjusters produces drift and clip artifacts on iOS + double height insets on Android.
333
+ const collectNestedKeyboardAvoidingViews = (
334
+ nodes: UIElement[],
335
+ insideKav: boolean,
336
+ out: string[]
337
+ ): void => {
338
+ for (const node of nodes) {
339
+ if (node.type === "KeyboardAvoidingView") {
340
+ if (insideKav) out.push(node.id);
341
+ collectNestedKeyboardAvoidingViews(node.children, true, out);
342
+ continue;
343
+ }
344
+ if (
345
+ node.type === "YStack" ||
346
+ node.type === "XStack" ||
347
+ node.type === "ZStack" ||
348
+ node.type === "SafeAreaView" ||
349
+ node.type === "ScrollView" ||
350
+ node.type === "Carousel"
351
+ ) {
352
+ collectNestedKeyboardAvoidingViews(node.children, insideKav, out);
353
+ }
354
+ }
355
+ };
356
+
357
+ export const ComposableScreenStepPayloadSchema = z
358
+ .object({
359
+ elements: z.array(UIElementSchema),
360
+ })
361
+ .superRefine((payload, ctx) => {
362
+ const offenders: string[] = [];
363
+ collectNestedKeyboardAvoidingViews(payload.elements, false, offenders);
364
+ for (const id of offenders) {
365
+ ctx.addIssue({
366
+ code: z.ZodIssueCode.custom,
367
+ path: ["elements"],
368
+ message: `KeyboardAvoidingView (id="${id}") cannot be nested inside another KeyboardAvoidingView.`,
369
+ });
370
+ }
371
+ });
291
372
 
292
373
  export const ComposableScreenStepTypeSchema = BaseStepTypeSchema.extend({
293
374
  type: z.literal("ComposableScreen"),