@rocapine/react-native-onboarding-ui 1.11.1 → 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.
- package/dist/UI/Pages/ComposableScreen/Renderer.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/Renderer.js +7 -1
- package/dist/UI/Pages/ComposableScreen/Renderer.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts +67 -0
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js +15 -1
- package/dist/UI/Pages/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js +40 -14
- package/dist/UI/Pages/ComposableScreen/elements/ButtonElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js +3 -2
- package/dist/UI/Pages/ComposableScreen/elements/CarouselElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js +3 -1
- package/dist/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js +4 -2
- package/dist/UI/Pages/ComposableScreen/elements/DatePickerElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/GradientBox.d.ts +11 -0
- package/dist/UI/Pages/ComposableScreen/elements/GradientBox.d.ts.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/GradientBox.js +33 -0
- package/dist/UI/Pages/ComposableScreen/elements/GradientBox.js.map +1 -0
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.js +3 -3
- package/dist/UI/Pages/ComposableScreen/elements/IconElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js +51 -23
- package/dist/UI/Pages/ComposableScreen/elements/ImageElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/InputElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js +4 -3
- package/dist/UI/Pages/ComposableScreen/elements/LottieElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js +3 -1
- package/dist/UI/Pages/ComposableScreen/elements/RadioGroupElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.js +3 -3
- package/dist/UI/Pages/ComposableScreen/elements/StackElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js +48 -21
- package/dist/UI/Pages/ComposableScreen/elements/TextElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts +27 -0
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js +4 -3
- package/dist/UI/Pages/ComposableScreen/elements/VideoElement.js.map +1 -1
- package/dist/UI/Pages/ComposableScreen/types.d.ts +1 -1
- package/dist/UI/Pages/ComposableScreen/types.js +1 -1
- package/dist/UI/Pages/ComposableScreen/types.js.map +1 -1
- package/package.json +5 -1
- package/src/UI/Pages/ComposableScreen/Renderer.tsx +13 -3
- package/src/UI/Pages/ComposableScreen/elements/BaseBoxProps.ts +42 -0
- package/src/UI/Pages/ComposableScreen/elements/ButtonElement.tsx +56 -12
- package/src/UI/Pages/ComposableScreen/elements/CarouselElement.tsx +5 -4
- package/src/UI/Pages/ComposableScreen/elements/CheckboxGroupElement.tsx +5 -3
- package/src/UI/Pages/ComposableScreen/elements/DatePickerElement.tsx +6 -4
- package/src/UI/Pages/ComposableScreen/elements/GradientBox.tsx +56 -0
- package/src/UI/Pages/ComposableScreen/elements/IconElement.tsx +5 -4
- package/src/UI/Pages/ComposableScreen/elements/ImageElement.tsx +64 -24
- package/src/UI/Pages/ComposableScreen/elements/LottieElement.tsx +10 -6
- package/src/UI/Pages/ComposableScreen/elements/RadioGroupElement.tsx +5 -3
- package/src/UI/Pages/ComposableScreen/elements/StackElement.tsx +5 -4
- package/src/UI/Pages/ComposableScreen/elements/TextElement.tsx +56 -20
- package/src/UI/Pages/ComposableScreen/elements/VideoElement.tsx +10 -6
- package/src/UI/Pages/ComposableScreen/types.ts +1 -1
|
@@ -4,6 +4,7 @@ import { 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 ButtonElementProps = BaseBoxProps & {
|
|
9
10
|
label: string;
|
|
@@ -55,13 +56,66 @@ export const ButtonElementComponent = ({ element, ctx }: Props): React.ReactElem
|
|
|
55
56
|
? (element.props.color ?? theme.colors.text.opposite)
|
|
56
57
|
: (element.props.color ?? theme.colors.primary);
|
|
57
58
|
|
|
59
|
+
const hasGradient = isFilled && !!element.props.backgroundGradient;
|
|
60
|
+
const borderRadius = element.props.borderRadius ?? 90;
|
|
61
|
+
|
|
62
|
+
const labelNode = (
|
|
63
|
+
<Text
|
|
64
|
+
style={{
|
|
65
|
+
color: textColor,
|
|
66
|
+
fontSize: element.props.fontSize ?? theme.typography.textStyles.button.fontSize,
|
|
67
|
+
fontWeight: (element.props.fontWeight as any) ?? theme.typography.textStyles.button.fontWeight,
|
|
68
|
+
fontFamily: element.props.fontFamily,
|
|
69
|
+
textAlign: element.props.textAlign ?? "center",
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{element.props.label}
|
|
73
|
+
</Text>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (hasGradient) {
|
|
77
|
+
return (
|
|
78
|
+
<GradientBox
|
|
79
|
+
gradient={element.props.backgroundGradient}
|
|
80
|
+
style={{
|
|
81
|
+
borderRadius,
|
|
82
|
+
borderWidth: isOutlined ? (element.props.borderWidth ?? 1) : (element.props.borderWidth ?? 0),
|
|
83
|
+
borderColor: isOutlined ? (element.props.borderColor ?? theme.colors.primary) : element.props.borderColor,
|
|
84
|
+
width: dim(element.props.width),
|
|
85
|
+
height: dim(element.props.height),
|
|
86
|
+
margin: element.props.margin,
|
|
87
|
+
marginHorizontal: element.props.marginHorizontal,
|
|
88
|
+
marginVertical: element.props.marginVertical,
|
|
89
|
+
opacity: element.props.opacity,
|
|
90
|
+
alignSelf: element.props.alignSelf ?? (element.props.width ? undefined : "stretch"),
|
|
91
|
+
overflow: "hidden",
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
<TouchableOpacity
|
|
95
|
+
activeOpacity={0.8}
|
|
96
|
+
onPress={handlePress}
|
|
97
|
+
style={{
|
|
98
|
+
flex: 1,
|
|
99
|
+
padding: element.props.padding,
|
|
100
|
+
paddingVertical: element.props.paddingVertical ?? 14,
|
|
101
|
+
paddingHorizontal: element.props.paddingHorizontal ?? 24,
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
justifyContent: "center",
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{labelNode}
|
|
107
|
+
</TouchableOpacity>
|
|
108
|
+
</GradientBox>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
58
112
|
return (
|
|
59
113
|
<TouchableOpacity
|
|
60
114
|
activeOpacity={0.8}
|
|
61
115
|
onPress={handlePress}
|
|
62
116
|
style={{
|
|
63
117
|
backgroundColor: bgColor,
|
|
64
|
-
borderRadius
|
|
118
|
+
borderRadius,
|
|
65
119
|
borderWidth: isOutlined ? (element.props.borderWidth ?? 1) : (element.props.borderWidth ?? 0),
|
|
66
120
|
borderColor: isOutlined ? (element.props.borderColor ?? theme.colors.primary) : element.props.borderColor,
|
|
67
121
|
padding: element.props.padding,
|
|
@@ -78,17 +132,7 @@ export const ButtonElementComponent = ({ element, ctx }: Props): React.ReactElem
|
|
|
78
132
|
justifyContent: "center",
|
|
79
133
|
}}
|
|
80
134
|
>
|
|
81
|
-
|
|
82
|
-
style={{
|
|
83
|
-
color: textColor,
|
|
84
|
-
fontSize: element.props.fontSize ?? theme.typography.textStyles.button.fontSize,
|
|
85
|
-
fontWeight: (element.props.fontWeight as any) ?? theme.typography.textStyles.button.fontWeight,
|
|
86
|
-
fontFamily: element.props.fontFamily,
|
|
87
|
-
textAlign: element.props.textAlign ?? "center",
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
{element.props.label}
|
|
91
|
-
</Text>
|
|
135
|
+
{labelNode}
|
|
92
136
|
</TouchableOpacity>
|
|
93
137
|
);
|
|
94
138
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import { useWindowDimensions
|
|
2
|
+
import { useWindowDimensions } from "react-native";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { useSharedValue } from "react-native-reanimated";
|
|
5
5
|
import Carousel, { Pagination, ICarouselInstance } from "react-native-reanimated-carousel";
|
|
6
6
|
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
7
7
|
import type { UIElement } from "../types";
|
|
8
8
|
import { dim, type RenderContext } from "./shared";
|
|
9
|
+
import { GradientBox } from "./GradientBox";
|
|
9
10
|
|
|
10
11
|
export type CarouselElementProps = BaseBoxProps & {
|
|
11
12
|
carouselType?: "left-align" | "normal" | "parallax" | "stack";
|
|
@@ -79,7 +80,7 @@ export function CarouselElementComponent({ element, ctx }: Props): React.ReactEl
|
|
|
79
80
|
borderRadius: props.borderRadius,
|
|
80
81
|
borderWidth: props.borderWidth,
|
|
81
82
|
borderColor: props.borderColor,
|
|
82
|
-
backgroundColor: props.backgroundColor,
|
|
83
|
+
backgroundColor: props.backgroundGradient ? undefined : props.backgroundColor,
|
|
83
84
|
opacity: props.opacity,
|
|
84
85
|
// Left-align shows the next slide peeking — must not clip
|
|
85
86
|
overflow: carouselType === "left-align" ? ("visible" as const) : (props.overflow ?? ("hidden" as const)),
|
|
@@ -108,7 +109,7 @@ export function CarouselElementComponent({ element, ctx }: Props): React.ReactEl
|
|
|
108
109
|
console.log(props.autoPlay, props.autoPlayInterval);
|
|
109
110
|
console.log(element);
|
|
110
111
|
return (
|
|
111
|
-
<
|
|
112
|
+
<GradientBox gradient={props.backgroundGradient} style={containerStyle as any}>
|
|
112
113
|
<Carousel
|
|
113
114
|
ref={ref}
|
|
114
115
|
loop={props.loop}
|
|
@@ -147,6 +148,6 @@ export function CarouselElementComponent({ element, ctx }: Props): React.ReactEl
|
|
|
147
148
|
}}
|
|
148
149
|
/>
|
|
149
150
|
)}
|
|
150
|
-
</
|
|
151
|
+
</GradientBox>
|
|
151
152
|
);
|
|
152
153
|
}
|
|
@@ -4,6 +4,7 @@ import { View, Text, TouchableOpacity } from "react-native";
|
|
|
4
4
|
import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
5
5
|
import type { UIElement } from "../types";
|
|
6
6
|
import { dim, type RenderContext } from "./shared";
|
|
7
|
+
import { GradientBox } from "./GradientBox";
|
|
7
8
|
|
|
8
9
|
export type CheckboxGroupElementProps = BaseBoxProps & {
|
|
9
10
|
variableName?: string;
|
|
@@ -102,8 +103,8 @@ export const CheckboxGroupComponent = ({ element, ctx }: Props): React.ReactElem
|
|
|
102
103
|
const isHorizontal = element.props.direction === "horizontal";
|
|
103
104
|
|
|
104
105
|
return (
|
|
105
|
-
<
|
|
106
|
-
|
|
106
|
+
<GradientBox
|
|
107
|
+
gradient={element.props.backgroundGradient}
|
|
107
108
|
style={{
|
|
108
109
|
flexDirection: isHorizontal ? "row" : "column",
|
|
109
110
|
flexWrap: isHorizontal ? "wrap" : undefined,
|
|
@@ -120,6 +121,7 @@ export const CheckboxGroupComponent = ({ element, ctx }: Props): React.ReactElem
|
|
|
120
121
|
borderWidth: element.props.borderWidth,
|
|
121
122
|
borderRadius: element.props.borderRadius,
|
|
122
123
|
borderColor: element.props.borderColor,
|
|
124
|
+
backgroundColor: element.props.backgroundGradient ? undefined : element.props.backgroundColor,
|
|
123
125
|
opacity: element.props.opacity,
|
|
124
126
|
}}
|
|
125
127
|
>
|
|
@@ -195,6 +197,6 @@ export const CheckboxGroupComponent = ({ element, ctx }: Props): React.ReactElem
|
|
|
195
197
|
</TouchableOpacity>
|
|
196
198
|
);
|
|
197
199
|
})}
|
|
198
|
-
</
|
|
200
|
+
</GradientBox>
|
|
199
201
|
);
|
|
200
202
|
};
|
|
@@ -5,6 +5,7 @@ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import type { UIElement } from "../types";
|
|
7
7
|
import { dim, type RenderContext } from "./shared";
|
|
8
|
+
import { GradientBox } from "./GradientBox";
|
|
8
9
|
|
|
9
10
|
export type DatePickerElementProps = BaseBoxProps & {
|
|
10
11
|
variableName?: string;
|
|
@@ -105,6 +106,7 @@ export const DatePickerElementComponent = ({ element, ctx }: Props): React.React
|
|
|
105
106
|
borderWidth: props.borderWidth,
|
|
106
107
|
borderRadius: props.borderRadius,
|
|
107
108
|
borderColor: props.borderColor,
|
|
109
|
+
backgroundColor: props.backgroundGradient ? undefined : props.backgroundColor,
|
|
108
110
|
overflow: "hidden" as const,
|
|
109
111
|
};
|
|
110
112
|
|
|
@@ -122,7 +124,7 @@ export const DatePickerElementComponent = ({ element, ctx }: Props): React.React
|
|
|
122
124
|
|
|
123
125
|
if (Platform.OS === "android") {
|
|
124
126
|
return (
|
|
125
|
-
<
|
|
127
|
+
<GradientBox gradient={props.backgroundGradient} style={containerStyle as any}>
|
|
126
128
|
<Pressable
|
|
127
129
|
onPress={() => setPickerVisible(true)}
|
|
128
130
|
style={{
|
|
@@ -157,16 +159,16 @@ export const DatePickerElementComponent = ({ element, ctx }: Props): React.React
|
|
|
157
159
|
}}
|
|
158
160
|
/>
|
|
159
161
|
)}
|
|
160
|
-
</
|
|
162
|
+
</GradientBox>
|
|
161
163
|
);
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
return (
|
|
165
|
-
<
|
|
167
|
+
<GradientBox gradient={props.backgroundGradient} style={containerStyle as any}>
|
|
166
168
|
<DateTimePicker
|
|
167
169
|
{...pickerProps}
|
|
168
170
|
display={(props.display ?? "spinner") as any}
|
|
169
171
|
/>
|
|
170
|
-
</
|
|
172
|
+
</GradientBox>
|
|
171
173
|
);
|
|
172
174
|
};
|
|
@@ -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
|
-
<
|
|
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
|
-
</
|
|
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:
|
|
33
|
-
resizeMode={
|
|
72
|
+
source={{ uri: p.url }}
|
|
73
|
+
resizeMode={p.resizeMode}
|
|
34
74
|
style={({
|
|
35
|
-
flex:
|
|
36
|
-
flexShrink:
|
|
37
|
-
flexGrow:
|
|
38
|
-
alignSelf:
|
|
39
|
-
width: dim(
|
|
40
|
-
height: dim(
|
|
41
|
-
minWidth:
|
|
42
|
-
maxWidth:
|
|
43
|
-
minHeight:
|
|
44
|
-
maxHeight:
|
|
45
|
-
backgroundColor:
|
|
46
|
-
overflow:
|
|
47
|
-
borderRadius:
|
|
48
|
-
borderWidth:
|
|
49
|
-
borderColor:
|
|
50
|
-
opacity:
|
|
51
|
-
margin:
|
|
52
|
-
marginHorizontal:
|
|
53
|
-
marginVertical:
|
|
54
|
-
padding:
|
|
55
|
-
paddingHorizontal:
|
|
56
|
-
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 {
|
|
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
|
-
<
|
|
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
|
-
</
|
|
80
|
+
</GradientBox>
|
|
77
81
|
);
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
return (
|
|
81
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
89
|
-
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
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
|
};
|