@builder.io/sdk-react-native 0.0.1-22 → 0.0.1-26
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/package.json +3 -2
- package/src/blocks/button.js +66 -24
- package/src/blocks/button.lite.tsx +9 -13
- package/src/blocks/columns.js +247 -36
- package/src/blocks/columns.lite.tsx +7 -7
- package/src/blocks/custom-code.js +73 -47
- package/src/blocks/custom-code.lite.tsx +12 -16
- package/src/blocks/embed.js +66 -47
- package/src/blocks/embed.lite.tsx +11 -13
- package/src/blocks/form.js +436 -198
- package/src/blocks/form.lite.tsx +67 -78
- package/src/blocks/fragment.js +16 -11
- package/src/blocks/fragment.lite.tsx +8 -5
- package/src/blocks/image.js +89 -80
- package/src/blocks/image.lite.tsx +44 -13
- package/src/blocks/img.js +45 -28
- package/src/blocks/img.lite.tsx +7 -7
- package/src/blocks/input.js +93 -28
- package/src/blocks/input.lite.tsx +5 -9
- package/src/blocks/raw-text.js +16 -12
- package/src/blocks/raw-text.lite.tsx +3 -3
- package/src/blocks/section.js +66 -23
- package/src/blocks/section.lite.tsx +4 -4
- package/src/blocks/select.js +67 -28
- package/src/blocks/select.lite.tsx +6 -10
- package/src/blocks/submit-button.js +41 -21
- package/src/blocks/submit-button.lite.tsx +3 -3
- package/src/blocks/symbol.js +18 -16
- package/src/blocks/symbol.lite.tsx +5 -5
- package/src/blocks/text.js +29 -27
- package/src/blocks/text.lite.tsx +4 -9
- package/src/blocks/textarea.js +53 -24
- package/src/blocks/textarea.lite.tsx +3 -3
- package/src/blocks/video.js +112 -46
- package/src/blocks/video.lite.tsx +6 -6
- package/src/components/block-styles.js +2 -4
- package/src/components/block-styles.lite.tsx +3 -3
- package/src/components/error-boundary.js +11 -9
- package/src/components/error-boundary.lite.tsx +3 -3
- package/src/components/render-block.js +89 -36
- package/src/components/render-block.lite.tsx +47 -32
- package/src/components/render-blocks.js +56 -32
- package/src/components/render-blocks.lite.tsx +16 -16
- package/src/components/render-content.js +160 -36
- package/src/components/render-content.lite.tsx +139 -39
- package/src/constants/device-sizes.js +8 -11
- package/src/context/builder.context.js +2 -4
- package/src/functions/evaluate.js +17 -9
- package/src/functions/get-block-actions.js +9 -10
- package/src/functions/get-block-component-options.js +11 -10
- package/src/functions/get-block-properties.js +15 -17
- package/src/functions/get-block-styles.js +25 -17
- package/src/functions/get-block-tag.js +2 -4
- package/src/functions/get-content.js +54 -27
- package/src/functions/get-fetch.js +11 -0
- package/src/functions/get-global-this.js +17 -0
- package/src/functions/get-processed-block.js +11 -13
- package/src/functions/get-processed-block.test.js +14 -14
- package/src/functions/get-target.js +3 -5
- package/src/functions/if-target.js +1 -3
- package/src/functions/is-browser.js +3 -5
- package/src/functions/is-editing.js +3 -5
- package/src/functions/is-iframe.js +2 -4
- package/src/functions/is-previewing.js +13 -0
- package/src/functions/is-react-native.js +2 -4
- package/src/functions/macro-eval.js +2 -5
- package/src/functions/on-change.js +4 -7
- package/src/functions/on-change.test.js +10 -10
- package/src/functions/previewing-model-name.js +10 -0
- package/src/functions/register-component.js +34 -28
- package/src/functions/register.js +8 -10
- package/src/functions/set-editor-settings.js +5 -7
- package/src/functions/set.js +10 -4
- package/src/functions/set.test.js +14 -14
- package/src/functions/track.js +6 -8
- package/src/index.js +18 -20
- package/src/scripts/init-editing.js +65 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { useContext } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function Textarea(props) {
|
|
6
6
|
return (
|
package/src/blocks/video.js
CHANGED
|
@@ -1,49 +1,115 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import ReactVideo from 'react-native-video';
|
|
1
4
|
import { registerComponent } from '../functions/register-component';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
import { View } from "react-native";
|
|
24
5
|
function Video(props) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
6
|
+
return /* @__PURE__ */ React.createElement(
|
|
7
|
+
View,
|
|
8
|
+
{
|
|
9
|
+
style: { position: 'relative' },
|
|
10
|
+
},
|
|
11
|
+
/* @__PURE__ */ React.createElement(ReactVideo, {
|
|
12
|
+
paused: !props.autoPlay,
|
|
13
|
+
controls: props.controls,
|
|
14
|
+
muted: props.muted,
|
|
15
|
+
repeat: props.loop,
|
|
16
|
+
poster: props.posterImage,
|
|
17
|
+
posterResizeMode: props.fit || 'contain',
|
|
18
|
+
resizeMode: props.fit || 'contain',
|
|
19
|
+
style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0 },
|
|
20
|
+
source: { uri: props.video },
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ React.createElement(View, {
|
|
23
|
+
style: {
|
|
24
|
+
width: '100%',
|
|
25
|
+
paddingTop: props.aspectRatio * 100 + '%',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
);
|
|
43
29
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
registerComponent(Image, {
|
|
31
|
+
name: 'Image',
|
|
32
|
+
static: true,
|
|
33
|
+
builtIn: true,
|
|
34
|
+
image:
|
|
35
|
+
'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',
|
|
36
|
+
defaultStyles: {
|
|
37
|
+
position: 'relative',
|
|
38
|
+
minHeight: '20px',
|
|
39
|
+
minWidth: '20px',
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
},
|
|
42
|
+
canHaveChildren: true,
|
|
43
|
+
inputs: [
|
|
44
|
+
{
|
|
45
|
+
name: 'video',
|
|
46
|
+
type: 'file',
|
|
47
|
+
allowedFileTypes: ['mp4'],
|
|
48
|
+
bubble: true,
|
|
49
|
+
defaultValue:
|
|
50
|
+
'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'posterImage',
|
|
55
|
+
type: 'file',
|
|
56
|
+
allowedFileTypes: ['jpeg', 'png'],
|
|
57
|
+
helperText: 'Image to show before the video plays',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'posterImage',
|
|
61
|
+
type: 'file',
|
|
62
|
+
allowedFileTypes: ['jpeg', 'png'],
|
|
63
|
+
helperText: 'Image to show before the video plays',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'autoPlay',
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
defaultValue: true,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'controls',
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
defaultValue: false,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'muted',
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
defaultValue: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'loop',
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
defaultValue: true,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'fit',
|
|
87
|
+
type: 'text',
|
|
88
|
+
defaultValue: 'cover',
|
|
89
|
+
enum: ['contain', 'cover', 'stretch'],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'position',
|
|
93
|
+
type: 'text',
|
|
94
|
+
defaultValue: 'center',
|
|
95
|
+
enum: [
|
|
96
|
+
'center',
|
|
97
|
+
'top',
|
|
98
|
+
'left',
|
|
99
|
+
'right',
|
|
100
|
+
'bottom',
|
|
101
|
+
'top left',
|
|
102
|
+
'top right',
|
|
103
|
+
'bottom left',
|
|
104
|
+
'bottom right',
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'aspectRatio',
|
|
109
|
+
type: 'number',
|
|
110
|
+
advanced: true,
|
|
111
|
+
defaultValue: 0.7004048582995948,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
export { Video as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { useContext } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function Video(props) {
|
|
6
6
|
return (
|
|
@@ -8,8 +8,8 @@ export default function Video(props) {
|
|
|
8
8
|
{...props.attributes}
|
|
9
9
|
preload="none"
|
|
10
10
|
style={{
|
|
11
|
-
width:
|
|
12
|
-
height:
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%',
|
|
13
13
|
...props.attributes?.style,
|
|
14
14
|
objectFit: props.fit,
|
|
15
15
|
objectPosition: props.position,
|
|
@@ -17,7 +17,7 @@ export default function Video(props) {
|
|
|
17
17
|
// not have the video overflow
|
|
18
18
|
borderRadius: 1,
|
|
19
19
|
}}
|
|
20
|
-
key={props.video ||
|
|
20
|
+
key={props.video || 'no-src'}
|
|
21
21
|
poster={props.posterImage}
|
|
22
22
|
autoPlay={props.autoPlay}
|
|
23
23
|
muted={props.muted}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { useContext } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function BlockStyles(props) {
|
|
6
6
|
return <></>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Text } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
3
|
class ErrorBoundary extends React.Component {
|
|
4
4
|
constructor(props) {
|
|
5
5
|
super(props);
|
|
@@ -9,17 +9,19 @@ class ErrorBoundary extends React.Component {
|
|
|
9
9
|
return { hasError: true };
|
|
10
10
|
}
|
|
11
11
|
componentDidCatch(error, errorInfo) {
|
|
12
|
-
console.error(
|
|
12
|
+
console.error('Error rendering Builder.io block', error, errorInfo);
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
15
|
if (this.state.hasError) {
|
|
16
|
-
return /* @__PURE__ */ React.createElement(
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return /* @__PURE__ */ React.createElement(
|
|
17
|
+
Text,
|
|
18
|
+
{
|
|
19
|
+
style: { color: 'gray' },
|
|
20
|
+
},
|
|
21
|
+
'Error rendering Builder.io block'
|
|
22
|
+
);
|
|
19
23
|
}
|
|
20
24
|
return this.props.children;
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
|
-
export {
|
|
24
|
-
ErrorBoundary as default
|
|
25
|
-
};
|
|
27
|
+
export { ErrorBoundary as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { useContext } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function ErrorBoundary(props) {
|
|
6
6
|
return <></>;
|
|
@@ -4,39 +4,40 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) =>
|
|
7
|
+
var __defNormalProp = (obj, key, value) =>
|
|
8
|
+
key in obj
|
|
9
|
+
? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
|
|
10
|
+
: (obj[key] = value);
|
|
8
11
|
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
12
13
|
if (__getOwnPropSymbols)
|
|
13
14
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
16
16
|
}
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import * as React from
|
|
21
|
-
import { useContext } from
|
|
22
|
-
import { getBlockComponentOptions } from
|
|
23
|
-
import { getBlockProperties } from
|
|
24
|
-
import { getBlockStyles } from
|
|
25
|
-
import { getBlockTag } from
|
|
26
|
-
import { components } from
|
|
27
|
-
import BuilderContext from
|
|
28
|
-
import { getBlockActions } from
|
|
29
|
-
import { getProcessedBlock } from
|
|
30
|
-
import BlockStyles from
|
|
20
|
+
import * as React from 'react';
|
|
21
|
+
import { useContext } from 'react';
|
|
22
|
+
import { getBlockComponentOptions } from '../functions/get-block-component-options';
|
|
23
|
+
import { getBlockProperties } from '../functions/get-block-properties';
|
|
24
|
+
import { getBlockStyles } from '../functions/get-block-styles';
|
|
25
|
+
import { getBlockTag } from '../functions/get-block-tag';
|
|
26
|
+
import { components } from '../functions/register-component';
|
|
27
|
+
import BuilderContext from '../context/builder.context';
|
|
28
|
+
import { getBlockActions } from '../functions/get-block-actions';
|
|
29
|
+
import { getProcessedBlock } from '../functions/get-processed-block';
|
|
30
|
+
import BlockStyles from './block-styles';
|
|
31
|
+
import RenderBlocks from './render-blocks';
|
|
31
32
|
function RenderBlock(props) {
|
|
32
|
-
var _a;
|
|
33
|
+
var _a, _b, _c;
|
|
33
34
|
function component() {
|
|
34
|
-
var _a2,
|
|
35
|
+
var _a2, _b2;
|
|
35
36
|
const componentName = (_a2 = useBlock().component) == null ? void 0 : _a2.name;
|
|
36
37
|
if (!componentName) {
|
|
37
38
|
return null;
|
|
38
39
|
}
|
|
39
|
-
const ref = components[(
|
|
40
|
+
const ref = components[(_b2 = useBlock().component) == null ? void 0 : _b2.name];
|
|
40
41
|
if (componentName && !ref) {
|
|
41
42
|
console.warn(`
|
|
42
43
|
Could not find a registered component named "${componentName}".
|
|
@@ -62,14 +63,14 @@ function RenderBlock(props) {
|
|
|
62
63
|
return getProcessedBlock({
|
|
63
64
|
block: props.block,
|
|
64
65
|
state: builderContext.state,
|
|
65
|
-
context: builderContext.context
|
|
66
|
+
context: builderContext.context,
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
function actions() {
|
|
69
70
|
return getBlockActions({
|
|
70
71
|
block: useBlock(),
|
|
71
72
|
state: builderContext.state,
|
|
72
|
-
context: builderContext.context
|
|
73
|
+
context: builderContext.context,
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
function css() {
|
|
@@ -79,19 +80,71 @@ function RenderBlock(props) {
|
|
|
79
80
|
return getBlockComponentOptions(useBlock());
|
|
80
81
|
}
|
|
81
82
|
const builderContext = useContext(BuilderContext);
|
|
82
|
-
const TagNameRef = tagName();
|
|
83
83
|
const ComponentRefRef = componentRef();
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
const TagNameRef = tagName();
|
|
85
|
+
return /* @__PURE__ */ React.createElement(
|
|
86
|
+
React.Fragment,
|
|
87
|
+
null,
|
|
88
|
+
!((_a = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a.noWrap)
|
|
89
|
+
? /* @__PURE__ */ React.createElement(
|
|
90
|
+
React.Fragment,
|
|
91
|
+
null,
|
|
92
|
+
/* @__PURE__ */ React.createElement(
|
|
93
|
+
TagNameRef,
|
|
94
|
+
__spreadProps(__spreadValues({}, properties()), {
|
|
95
|
+
style: css(),
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ React.createElement(BlockStyles, {
|
|
98
|
+
block: useBlock(),
|
|
99
|
+
}),
|
|
100
|
+
componentRef()
|
|
101
|
+
? /* @__PURE__ */ React.createElement(
|
|
102
|
+
ComponentRefRef,
|
|
103
|
+
__spreadProps(__spreadValues({}, componentOptions()), {
|
|
104
|
+
builderBlock: useBlock(),
|
|
105
|
+
}),
|
|
106
|
+
useBlock().children
|
|
107
|
+
? /* @__PURE__ */ React.createElement(
|
|
108
|
+
React.Fragment,
|
|
109
|
+
null,
|
|
110
|
+
/* @__PURE__ */ React.createElement(RenderBlocks, {
|
|
111
|
+
path: 'children',
|
|
112
|
+
blocks: useBlock().children,
|
|
113
|
+
})
|
|
114
|
+
)
|
|
115
|
+
: null
|
|
116
|
+
)
|
|
117
|
+
: null,
|
|
118
|
+
!componentRef() && useBlock().children && useBlock().children.length
|
|
119
|
+
? /* @__PURE__ */ React.createElement(
|
|
120
|
+
React.Fragment,
|
|
121
|
+
null,
|
|
122
|
+
(_b = useBlock().children) == null
|
|
123
|
+
? void 0
|
|
124
|
+
: _b.map(child =>
|
|
125
|
+
/* @__PURE__ */ React.createElement(RenderBlock, {
|
|
126
|
+
block: child,
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
)
|
|
130
|
+
: null
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
: /* @__PURE__ */ React.createElement(
|
|
134
|
+
ComponentRefRef,
|
|
135
|
+
__spreadProps(
|
|
136
|
+
__spreadValues(
|
|
137
|
+
{},
|
|
138
|
+
(_c = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _c.options
|
|
139
|
+
),
|
|
140
|
+
{
|
|
141
|
+
attributes: properties(),
|
|
142
|
+
builderBlock: useBlock(),
|
|
143
|
+
style: css(),
|
|
144
|
+
children: useBlock().children,
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
);
|
|
94
149
|
}
|
|
95
|
-
export {
|
|
96
|
-
RenderBlock as default
|
|
97
|
-
};
|
|
150
|
+
export { RenderBlock as default };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { View, StyleSheet, Image, Text } from
|
|
3
|
-
import { useState, useContext } from
|
|
4
|
-
import { getBlockComponentOptions } from
|
|
5
|
-
import { getBlockProperties } from
|
|
6
|
-
import { getBlockStyles } from
|
|
7
|
-
import { getBlockTag } from
|
|
8
|
-
import { components } from
|
|
9
|
-
import BuilderContext from
|
|
10
|
-
import { getBlockActions } from
|
|
11
|
-
import { getProcessedBlock } from
|
|
12
|
-
import BlockStyles from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
+
import { useState, useContext } from 'react';
|
|
4
|
+
import { getBlockComponentOptions } from '../functions/get-block-component-options';
|
|
5
|
+
import { getBlockProperties } from '../functions/get-block-properties';
|
|
6
|
+
import { getBlockStyles } from '../functions/get-block-styles';
|
|
7
|
+
import { getBlockTag } from '../functions/get-block-tag';
|
|
8
|
+
import { components } from '../functions/register-component';
|
|
9
|
+
import BuilderContext from '../context/builder.context.lite';
|
|
10
|
+
import { getBlockActions } from '../functions/get-block-actions';
|
|
11
|
+
import { getProcessedBlock } from '../functions/get-processed-block';
|
|
12
|
+
import BlockStyles from './block-styles.lite';
|
|
13
|
+
import RenderBlocks from './render-blocks.lite';
|
|
13
14
|
|
|
14
15
|
export default function RenderBlock(props) {
|
|
15
16
|
function component() {
|
|
@@ -73,30 +74,44 @@ export default function RenderBlock(props) {
|
|
|
73
74
|
|
|
74
75
|
const builderContext = useContext(BuilderContext);
|
|
75
76
|
|
|
76
|
-
const TagNameRef = tagName();
|
|
77
77
|
const ComponentRefRef = componentRef();
|
|
78
|
+
const TagNameRef = tagName();
|
|
78
79
|
|
|
79
80
|
return (
|
|
80
81
|
<>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
))
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
82
|
+
{!componentInfo?.()?.noWrap ? (
|
|
83
|
+
<>
|
|
84
|
+
<TagNameRef {...properties()} style={css()}>
|
|
85
|
+
<BlockStyles block={useBlock()} />
|
|
86
|
+
|
|
87
|
+
{componentRef() ? (
|
|
88
|
+
<ComponentRefRef {...componentOptions()} builderBlock={useBlock()}>
|
|
89
|
+
{useBlock().children ? (
|
|
90
|
+
<>
|
|
91
|
+
<RenderBlocks path="children" blocks={useBlock().children} />
|
|
92
|
+
</>
|
|
93
|
+
) : null}
|
|
94
|
+
</ComponentRefRef>
|
|
95
|
+
) : null}
|
|
96
|
+
|
|
97
|
+
{!componentRef() && useBlock().children && useBlock().children.length ? (
|
|
98
|
+
<>
|
|
99
|
+
{useBlock().children?.map(child => (
|
|
100
|
+
<RenderBlock block={child} />
|
|
101
|
+
))}
|
|
102
|
+
</>
|
|
103
|
+
) : null}
|
|
104
|
+
</TagNameRef>
|
|
105
|
+
</>
|
|
106
|
+
) : (
|
|
107
|
+
<ComponentRefRef
|
|
108
|
+
{...componentInfo?.()?.options}
|
|
109
|
+
attributes={properties()}
|
|
110
|
+
builderBlock={useBlock()}
|
|
111
|
+
style={css()}
|
|
112
|
+
children={useBlock().children}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
100
115
|
</>
|
|
101
116
|
);
|
|
102
117
|
}
|