@rocapine/react-native-onboarding-ui 1.12.0 → 1.13.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 (74) hide show
  1. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +67 -0
  2. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
  3. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +15 -1
  4. package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
  5. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +27 -0
  6. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
  7. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js +40 -14
  8. package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js.map +1 -1
  9. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts +27 -0
  10. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
  11. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js +3 -2
  12. package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js.map +1 -1
  13. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts +27 -0
  14. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
  15. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js +3 -1
  16. package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -1
  17. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +27 -0
  18. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
  19. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js +4 -2
  20. package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js.map +1 -1
  21. package/dist/UI/Pages/ComposableScreen/elements/GradientBox.d.ts +11 -0
  22. package/dist/UI/Pages/ComposableScreen/elements/GradientBox.d.ts.map +1 -0
  23. package/dist/UI/Pages/ComposableScreen/elements/GradientBox.js +33 -0
  24. package/dist/UI/Pages/ComposableScreen/elements/GradientBox.js.map +1 -0
  25. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +27 -0
  26. package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -1
  27. package/dist/UI/Pages/ComposableScreen/elements/IconElement.js +3 -3
  28. package/dist/UI/Pages/ComposableScreen/elements/IconElement.js.map +1 -1
  29. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +27 -0
  30. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
  31. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js +51 -23
  32. package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js.map +1 -1
  33. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +27 -0
  34. package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -1
  35. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +27 -0
  36. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
  37. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js +4 -3
  38. package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js.map +1 -1
  39. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +27 -0
  40. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
  41. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js +3 -1
  42. package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js.map +1 -1
  43. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +27 -0
  44. package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
  45. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +27 -0
  46. package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -1
  47. package/dist/UI/Pages/ComposableScreen/elements/StackElement.js +3 -3
  48. package/dist/UI/Pages/ComposableScreen/elements/StackElement.js.map +1 -1
  49. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +27 -0
  50. package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
  51. package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +48 -21
  52. package/dist/UI/Pages/ComposableScreen/elements/TextElement.js.map +1 -1
  53. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +27 -0
  54. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
  55. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js +4 -3
  56. package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js.map +1 -1
  57. package/dist/UI/Pages/ComposableScreen/types.d.ts +1 -1
  58. package/dist/UI/Pages/ComposableScreen/types.js +1 -1
  59. package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
  60. package/package.json +5 -1
  61. package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +42 -0
  62. package/src/UI/Pages/ComposableScreen/elements/ButtonElement.tsx +56 -12
  63. package/src/UI/Pages/ComposableScreen/elements/CarouselElement.tsx +5 -4
  64. package/src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx +5 -3
  65. package/src/UI/Pages/ComposableScreen/elements/DatePickerElement.tsx +6 -4
  66. package/src/UI/Pages/ComposableScreen/elements/GradientBox.tsx +56 -0
  67. package/src/UI/Pages/ComposableScreen/elements/IconElement.tsx +5 -4
  68. package/src/UI/Pages/ComposableScreen/elements/ImageElement.tsx +64 -24
  69. package/src/UI/Pages/ComposableScreen/elements/LottieElement.tsx +10 -6
  70. package/src/UI/Pages/ComposableScreen/elements/RadioGroupElement.tsx +5 -3
  71. package/src/UI/Pages/ComposableScreen/elements/StackElement.tsx +5 -4
  72. package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +56 -20
  73. package/src/UI/Pages/ComposableScreen/elements/VideoElement.tsx +10 -6
  74. package/src/UI/Pages/ComposableScreen/types.ts +1 -1
@@ -0,0 +1,56 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import type { ViewStyle } from "react-native";
4
+ import type { GradientBackground } from "./BaseBoxProps";
5
+
6
+ let LinearGradient: React.ComponentType<{
7
+ colors: readonly [string, string, ...string[]];
8
+ start?: { x: number; y: number };
9
+ end?: { x: number; y: number };
10
+ locations?: number[];
11
+ style?: object;
12
+ children?: React.ReactNode;
13
+ }> | null = null;
14
+
15
+ try {
16
+ LinearGradient = require("expo-linear-gradient").LinearGradient;
17
+ } catch {
18
+ // expo-linear-gradient not installed
19
+ }
20
+
21
+ const EDGE_POINT: Record<string, { x: number; y: number }> = {
22
+ top: { x: 0.5, y: 0 },
23
+ bottom: { x: 0.5, y: 1 },
24
+ left: { x: 0, y: 0.5 },
25
+ right: { x: 1, y: 0.5 },
26
+ topLeft: { x: 0, y: 0 },
27
+ topRight: { x: 1, y: 0 },
28
+ bottomLeft: { x: 0, y: 1 },
29
+ bottomRight: { x: 1, y: 1 },
30
+ };
31
+
32
+ type Props = {
33
+ gradient?: GradientBackground;
34
+ style?: ViewStyle;
35
+ children?: React.ReactNode;
36
+ };
37
+
38
+ export const GradientBox = ({ gradient, style, children }: Props): React.ReactElement => {
39
+ if (gradient?.type === "linear" && LinearGradient) {
40
+ const colors = gradient.stops.map((s) => s.color) as [string, string, ...string[]];
41
+ const allHavePositions = gradient.stops.every((s) => s.position !== undefined);
42
+ const locations = allHavePositions ? (gradient.stops.map((s) => s.position!) as number[]) : undefined;
43
+ return (
44
+ <LinearGradient
45
+ colors={colors}
46
+ start={EDGE_POINT[gradient.from]}
47
+ end={EDGE_POINT[gradient.to]}
48
+ locations={locations}
49
+ style={style}
50
+ >
51
+ {children}
52
+ </LinearGradient>
53
+ );
54
+ }
55
+ return <View style={style}>{children}</View>;
56
+ };
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { z } from "zod";
3
- import { View } from "react-native";
4
3
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
4
  import { UIElement } from "../types";
6
5
  import { RenderContext, dim } from "./shared";
6
+ import { GradientBox } from "./GradientBox";
7
7
 
8
8
  export type IconElementProps = BaseBoxProps & {
9
9
  name: string;
@@ -38,7 +38,8 @@ export const IconElementComponent = ({ element, ctx }: Props): React.ReactElemen
38
38
  }> | undefined;
39
39
 
40
40
  return (
41
- <View
41
+ <GradientBox
42
+ gradient={element.props.backgroundGradient}
42
43
  style={{
43
44
  flex: element.props.flex,
44
45
  flexShrink: element.props.flexShrink,
@@ -60,7 +61,7 @@ export const IconElementComponent = ({ element, ctx }: Props): React.ReactElemen
60
61
  borderWidth: element.props.borderWidth,
61
62
  borderRadius: element.props.borderRadius,
62
63
  borderColor: element.props.borderColor,
63
- backgroundColor: element.props.backgroundColor,
64
+ backgroundColor: element.props.backgroundGradient ? undefined : element.props.backgroundColor,
64
65
  opacity: element.props.opacity,
65
66
  }}
66
67
  >
@@ -71,6 +72,6 @@ export const IconElementComponent = ({ element, ctx }: Props): React.ReactElemen
71
72
  strokeWidth={element.props.strokeWidth ?? 2}
72
73
  />
73
74
  ) : null}
74
- </View>
75
+ </GradientBox>
75
76
  );
76
77
  };
@@ -4,6 +4,7 @@ import { Image } from "react-native";
4
4
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
5
  import { UIElement } from "../types";
6
6
  import { RenderContext, dim } from "./shared";
7
+ import { GradientBox } from "./GradientBox";
7
8
 
8
9
  export type ImageElementProps = BaseBoxProps & {
9
10
  url: string;
@@ -27,33 +28,72 @@ type Props = {
27
28
  export const ImageElementComponent = ({ element }: Props): React.ReactElement => {
28
29
  const hasExplicitHeight = element.props.height !== undefined;
29
30
 
31
+ const p = element.props;
32
+
33
+ if (p.backgroundGradient) {
34
+ return (
35
+ <GradientBox
36
+ gradient={p.backgroundGradient}
37
+ style={{
38
+ flex: p.flex,
39
+ flexShrink: p.flexShrink,
40
+ flexGrow: p.flexGrow,
41
+ alignSelf: p.alignSelf,
42
+ width: dim(p.width),
43
+ height: dim(p.height),
44
+ minWidth: p.minWidth,
45
+ maxWidth: p.maxWidth,
46
+ minHeight: p.minHeight,
47
+ maxHeight: p.maxHeight,
48
+ overflow: (p.overflow ?? "hidden") as any,
49
+ borderRadius: p.borderRadius,
50
+ borderWidth: p.borderWidth,
51
+ borderColor: p.borderColor,
52
+ opacity: p.opacity,
53
+ margin: p.margin,
54
+ marginHorizontal: p.marginHorizontal,
55
+ marginVertical: p.marginVertical,
56
+ padding: p.padding,
57
+ paddingHorizontal: p.paddingHorizontal,
58
+ paddingVertical: p.paddingVertical,
59
+ }}
60
+ >
61
+ <Image
62
+ source={{ uri: p.url }}
63
+ resizeMode={p.resizeMode}
64
+ style={{ width: "100%", height: "100%" }}
65
+ />
66
+ </GradientBox>
67
+ );
68
+ }
69
+
30
70
  return (
31
71
  <Image
32
- source={{ uri: element.props.url }}
33
- resizeMode={element.props.resizeMode}
72
+ source={{ uri: p.url }}
73
+ resizeMode={p.resizeMode}
34
74
  style={({
35
- flex: element.props.flex,
36
- flexShrink: element.props.flexShrink,
37
- flexGrow: element.props.flexGrow,
38
- alignSelf: element.props.alignSelf,
39
- width: dim(element.props.width),
40
- height: dim(element.props.height),
41
- minWidth: element.props.minWidth,
42
- maxWidth: element.props.maxWidth,
43
- minHeight: element.props.minHeight,
44
- maxHeight: element.props.maxHeight,
45
- backgroundColor: element.props.backgroundColor,
46
- overflow: element.props.overflow,
47
- borderRadius: element.props.borderRadius,
48
- borderWidth: element.props.borderWidth,
49
- borderColor: element.props.borderColor,
50
- opacity: element.props.opacity,
51
- margin: element.props.margin,
52
- marginHorizontal: element.props.marginHorizontal,
53
- marginVertical: element.props.marginVertical,
54
- padding: element.props.padding,
55
- paddingHorizontal: element.props.paddingHorizontal,
56
- paddingVertical: element.props.paddingVertical,
75
+ flex: p.flex,
76
+ flexShrink: p.flexShrink,
77
+ flexGrow: p.flexGrow,
78
+ alignSelf: p.alignSelf,
79
+ width: dim(p.width),
80
+ height: dim(p.height),
81
+ minWidth: p.minWidth,
82
+ maxWidth: p.maxWidth,
83
+ minHeight: p.minHeight,
84
+ maxHeight: p.maxHeight,
85
+ backgroundColor: p.backgroundColor,
86
+ overflow: p.overflow,
87
+ borderRadius: p.borderRadius,
88
+ borderWidth: p.borderWidth,
89
+ borderColor: p.borderColor,
90
+ opacity: p.opacity,
91
+ margin: p.margin,
92
+ marginHorizontal: p.marginHorizontal,
93
+ marginVertical: p.marginVertical,
94
+ padding: p.padding,
95
+ paddingHorizontal: p.paddingHorizontal,
96
+ paddingVertical: p.paddingVertical,
57
97
  }) as any}
58
98
  />
59
99
  );
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { z } from "zod";
3
- import { View, Text, StyleSheet } from "react-native";
3
+ import { Text, StyleSheet } from "react-native";
4
4
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
5
  import { UIElement } from "../types";
6
6
  import { RenderContext, dim } from "./shared";
7
7
  import { getTextStyle } from "../../../Theme/helpers";
8
+ import { GradientBox } from "./GradientBox";
8
9
 
9
10
  export type LottieElementProps = BaseBoxProps & {
10
11
  source: string;
@@ -54,7 +55,7 @@ export const LottieElementComponent = ({ element, ctx }: Props): React.ReactElem
54
55
  minHeight: element.props.minHeight,
55
56
  maxHeight: element.props.maxHeight,
56
57
  opacity: element.props.opacity,
57
- backgroundColor: element.props.backgroundColor,
58
+ backgroundColor: element.props.backgroundGradient ? undefined : element.props.backgroundColor,
58
59
  margin: element.props.margin,
59
60
  marginHorizontal: element.props.marginHorizontal,
60
61
  marginVertical: element.props.marginVertical,
@@ -69,16 +70,19 @@ export const LottieElementComponent = ({ element, ctx }: Props): React.ReactElem
69
70
 
70
71
  if (!LottieView) {
71
72
  return (
72
- <View style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }]}>
73
+ <GradientBox
74
+ gradient={element.props.backgroundGradient}
75
+ style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }] as any}
76
+ >
73
77
  <Text style={[styles.mediaFallbackText, getTextStyle(theme, "caption"), { color: theme.colors.text.tertiary }]}>
74
78
  Install lottie-react-native to render Lottie animations.
75
79
  </Text>
76
- </View>
80
+ </GradientBox>
77
81
  );
78
82
  }
79
83
 
80
84
  return (
81
- <View style={wrapperStyle}>
85
+ <GradientBox gradient={element.props.backgroundGradient} style={wrapperStyle as any}>
82
86
  <LottieView
83
87
  source={{ uri: element.props.source }}
84
88
  autoPlay={element.props.autoPlay ?? true}
@@ -86,7 +90,7 @@ export const LottieElementComponent = ({ element, ctx }: Props): React.ReactElem
86
90
  speed={element.props.speed}
87
91
  style={styles.fill}
88
92
  />
89
- </View>
93
+ </GradientBox>
90
94
  );
91
95
  };
92
96
 
@@ -4,6 +4,7 @@ import { View, Text, TouchableOpacity } from "react-native";
4
4
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
5
  import { UIElement } from "../types";
6
6
  import { RenderContext, dim } from "./shared";
7
+ import { GradientBox } from "./GradientBox";
7
8
 
8
9
  export type RadioGroupElementProps = BaseBoxProps & {
9
10
  variableName?: string;
@@ -85,8 +86,8 @@ export const RadioGroupComponent = ({ element, ctx }: Props): React.ReactElement
85
86
  const isHorizontal = element.props.direction === "horizontal";
86
87
 
87
88
  return (
88
- <View
89
- accessibilityRole="radiogroup"
89
+ <GradientBox
90
+ gradient={element.props.backgroundGradient}
90
91
  style={{
91
92
  flexDirection: isHorizontal ? "row" : "column",
92
93
  flexWrap: isHorizontal ? "wrap" : undefined,
@@ -103,6 +104,7 @@ export const RadioGroupComponent = ({ element, ctx }: Props): React.ReactElement
103
104
  borderWidth: element.props.borderWidth,
104
105
  borderRadius: element.props.borderRadius,
105
106
  borderColor: element.props.borderColor,
107
+ backgroundColor: element.props.backgroundGradient ? undefined : element.props.backgroundColor,
106
108
  opacity: element.props.opacity,
107
109
  }}
108
110
  >
@@ -177,6 +179,6 @@ export const RadioGroupComponent = ({ element, ctx }: Props): React.ReactElement
177
179
  </TouchableOpacity>
178
180
  );
179
181
  })}
180
- </View>
182
+ </GradientBox>
181
183
  );
182
184
  };
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { z } from "zod";
3
- import { View } from "react-native";
4
3
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
4
  import { UIElement } from "../types";
6
5
  import { RenderContext, dim } from "./shared";
6
+ import { GradientBox } from "./GradientBox";
7
7
 
8
8
  export type StackElementProps = BaseBoxProps & {
9
9
  gap?: number;
@@ -30,7 +30,8 @@ type Props = {
30
30
  export const StackElementComponent = ({ element, ctx, parentType }: Props): React.ReactElement => {
31
31
  const p = element.props;
32
32
  return (
33
- <View
33
+ <GradientBox
34
+ gradient={p.backgroundGradient}
34
35
  style={{
35
36
  flexDirection: element.type === "XStack" ? "row" : "column",
36
37
  gap: p.gap,
@@ -53,7 +54,7 @@ export const StackElementComponent = ({ element, ctx, parentType }: Props): Reac
53
54
  margin: p.margin,
54
55
  marginHorizontal: p.marginHorizontal,
55
56
  marginVertical: p.marginVertical,
56
- backgroundColor: p.backgroundColor,
57
+ backgroundColor: p.backgroundGradient ? undefined : p.backgroundColor,
57
58
  borderWidth: p.borderWidth,
58
59
  borderRadius: p.borderRadius,
59
60
  borderColor: p.borderColor,
@@ -62,6 +63,6 @@ export const StackElementComponent = ({ element, ctx, parentType }: Props): Reac
62
63
  }}
63
64
  >
64
65
  {ctx.renderChildren(element.children, element.type)}
65
- </View>
66
+ </GradientBox>
66
67
  );
67
68
  };
@@ -4,6 +4,7 @@ import { Text } from "react-native";
4
4
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
5
  import { UIElement } from "../types";
6
6
  import { RenderContext, interpolate, dim } from "./shared";
7
+ import { GradientBox } from "./GradientBox";
7
8
 
8
9
  export type TextElementProps = BaseBoxProps & {
9
10
  content: string;
@@ -45,19 +46,19 @@ export const TextElementComponent = ({ element, ctx, parentType }: Props): React
45
46
  ? interpolate(p.content, variables)
46
47
  : p.content;
47
48
 
48
- return (
49
+ const textNode = (
49
50
  <Text
50
51
  style={{
51
52
  flex: p.flex,
52
53
  flexShrink: p.flexShrink ?? (parentType === "XStack" ? 1 : undefined),
53
- flexGrow: p.flexGrow,
54
- alignSelf: p.alignSelf,
55
- width: dim(p.width),
56
- height: dim(p.height),
57
- minWidth: p.minWidth,
58
- maxWidth: p.maxWidth,
59
- minHeight: p.minHeight,
60
- maxHeight: p.maxHeight,
54
+ flexGrow: p.backgroundGradient ? undefined : p.flexGrow,
55
+ alignSelf: p.backgroundGradient ? undefined : p.alignSelf,
56
+ width: p.backgroundGradient ? undefined : dim(p.width),
57
+ height: p.backgroundGradient ? undefined : dim(p.height),
58
+ minWidth: p.backgroundGradient ? undefined : p.minWidth,
59
+ maxWidth: p.backgroundGradient ? undefined : p.maxWidth,
60
+ minHeight: p.backgroundGradient ? undefined : p.minHeight,
61
+ maxHeight: p.backgroundGradient ? undefined : p.maxHeight,
61
62
  fontSize: p.fontSize,
62
63
  fontWeight: p.fontWeight as any,
63
64
  fontFamily: p.fontFamily,
@@ -65,20 +66,55 @@ export const TextElementComponent = ({ element, ctx, parentType }: Props): React
65
66
  textAlign: p.textAlign,
66
67
  letterSpacing: p.letterSpacing,
67
68
  lineHeight: p.lineHeight,
68
- backgroundColor: p.backgroundColor,
69
- padding: p.padding,
70
- paddingHorizontal: p.paddingHorizontal,
71
- paddingVertical: p.paddingVertical,
72
- margin: p.margin,
73
- marginHorizontal: p.marginHorizontal,
74
- marginVertical: p.marginVertical,
75
- borderWidth: p.borderWidth,
76
- borderRadius: p.borderRadius,
77
- borderColor: p.borderColor,
78
- opacity: p.opacity,
69
+ backgroundColor: p.backgroundGradient ? undefined : p.backgroundColor,
70
+ padding: p.backgroundGradient ? undefined : p.padding,
71
+ paddingHorizontal: p.backgroundGradient ? undefined : p.paddingHorizontal,
72
+ paddingVertical: p.backgroundGradient ? undefined : p.paddingVertical,
73
+ margin: p.backgroundGradient ? undefined : p.margin,
74
+ marginHorizontal: p.backgroundGradient ? undefined : p.marginHorizontal,
75
+ marginVertical: p.backgroundGradient ? undefined : p.marginVertical,
76
+ borderWidth: p.backgroundGradient ? undefined : p.borderWidth,
77
+ borderRadius: p.backgroundGradient ? undefined : p.borderRadius,
78
+ borderColor: p.backgroundGradient ? undefined : p.borderColor,
79
+ opacity: p.backgroundGradient ? undefined : p.opacity,
79
80
  }}
80
81
  >
81
82
  {content}
82
83
  </Text>
83
84
  );
85
+
86
+ if (p.backgroundGradient) {
87
+ return (
88
+ <GradientBox
89
+ gradient={p.backgroundGradient}
90
+ style={{
91
+ flex: p.flex,
92
+ flexShrink: p.flexShrink ?? (parentType === "XStack" ? 1 : undefined),
93
+ flexGrow: p.flexGrow,
94
+ alignSelf: p.alignSelf,
95
+ width: dim(p.width),
96
+ height: dim(p.height),
97
+ minWidth: p.minWidth,
98
+ maxWidth: p.maxWidth,
99
+ minHeight: p.minHeight,
100
+ maxHeight: p.maxHeight,
101
+ padding: p.padding,
102
+ paddingHorizontal: p.paddingHorizontal,
103
+ paddingVertical: p.paddingVertical,
104
+ margin: p.margin,
105
+ marginHorizontal: p.marginHorizontal,
106
+ marginVertical: p.marginVertical,
107
+ borderWidth: p.borderWidth,
108
+ borderRadius: p.borderRadius,
109
+ borderColor: p.borderColor,
110
+ opacity: p.opacity,
111
+ overflow: "hidden",
112
+ }}
113
+ >
114
+ {textNode}
115
+ </GradientBox>
116
+ );
117
+ }
118
+
119
+ return textNode;
84
120
  };
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect } from "react";
2
2
  import { z } from "zod";
3
- import { View, Text, StyleSheet } from "react-native";
3
+ import { Text, StyleSheet } from "react-native";
4
4
  import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
5
5
  import { UIElement } from "../types";
6
6
  import { RenderContext, dim } from "./shared";
7
7
  import { getTextStyle } from "../../../Theme/helpers";
8
+ import { GradientBox } from "./GradientBox";
8
9
 
9
10
  export type VideoElementProps = BaseBoxProps & {
10
11
  url: string;
@@ -76,7 +77,7 @@ export const VideoElementRenderer = ({ element, ctx }: Props): React.ReactElemen
76
77
  minHeight: element.props.minHeight,
77
78
  maxHeight: element.props.maxHeight,
78
79
  opacity: element.props.opacity,
79
- backgroundColor: element.props.backgroundColor,
80
+ backgroundColor: element.props.backgroundGradient ? undefined : element.props.backgroundColor,
80
81
  margin: element.props.margin,
81
82
  marginHorizontal: element.props.marginHorizontal,
82
83
  marginVertical: element.props.marginVertical,
@@ -91,18 +92,21 @@ export const VideoElementRenderer = ({ element, ctx }: Props): React.ReactElemen
91
92
 
92
93
  if (!VideoElementComponent) {
93
94
  return (
94
- <View style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }]}>
95
+ <GradientBox
96
+ gradient={element.props.backgroundGradient}
97
+ style={[wrapperStyle, styles.mediaFallback, { backgroundColor: theme.colors.neutral.lowest }] as any}
98
+ >
95
99
  <Text style={[styles.mediaFallbackText, getTextStyle(theme, "caption"), { color: theme.colors.text.tertiary }]}>
96
100
  Install expo-video to render videos.
97
101
  </Text>
98
- </View>
102
+ </GradientBox>
99
103
  );
100
104
  }
101
105
 
102
106
  return (
103
- <View style={wrapperStyle}>
107
+ <GradientBox gradient={element.props.backgroundGradient} style={wrapperStyle as any}>
104
108
  <VideoElementComponent element={element} style={styles.fill} />
105
- </View>
109
+ </GradientBox>
106
110
  );
107
111
  };
108
112
 
@@ -211,7 +211,7 @@ export const ComposableScreenStepTypeSchema = z.object({
211
211
  payload: ComposableScreenStepPayloadSchema,
212
212
  customPayload: CustomPayloadSchema,
213
213
  continueButtonLabel: z.string().optional().default("Continue"),
214
- figmaUrl: z.string().nullable(),
214
+ figmaUrl: z.string().nullish(),
215
215
  });
216
216
 
217
217
  export type ComposableScreenStepType = z.infer<typeof ComposableScreenStepTypeSchema>;