@builder.io/sdk-react-native 0.0.1-4 → 0.0.1-40

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 (83) hide show
  1. package/package.json +6 -4
  2. package/src/blocks/button.js +73 -24
  3. package/src/blocks/button.lite.tsx +10 -14
  4. package/src/blocks/columns.js +258 -40
  5. package/src/blocks/columns.lite.tsx +7 -13
  6. package/src/blocks/custom-code.js +76 -47
  7. package/src/blocks/custom-code.lite.tsx +12 -12
  8. package/src/blocks/embed.js +69 -47
  9. package/src/blocks/embed.lite.tsx +11 -11
  10. package/src/blocks/form.js +491 -198
  11. package/src/blocks/form.lite.tsx +52 -56
  12. package/src/blocks/fragment.js +21 -0
  13. package/src/blocks/fragment.lite.tsx +10 -0
  14. package/src/blocks/image.js +89 -83
  15. package/src/blocks/image.lite.tsx +47 -14
  16. package/src/blocks/img.js +51 -28
  17. package/src/blocks/img.lite.tsx +6 -7
  18. package/src/blocks/input.js +100 -28
  19. package/src/blocks/input.lite.tsx +4 -7
  20. package/src/blocks/raw-text.js +16 -12
  21. package/src/blocks/raw-text.lite.tsx +2 -3
  22. package/src/blocks/section.js +71 -23
  23. package/src/blocks/section.lite.tsx +4 -5
  24. package/src/blocks/select.js +78 -27
  25. package/src/blocks/select.lite.tsx +8 -9
  26. package/src/blocks/submit-button.js +47 -21
  27. package/src/blocks/submit-button.lite.tsx +3 -4
  28. package/src/blocks/symbol.js +18 -16
  29. package/src/blocks/symbol.lite.tsx +5 -5
  30. package/src/blocks/text.js +85 -16
  31. package/src/blocks/text.lite.tsx +3 -4
  32. package/src/blocks/textarea.js +60 -24
  33. package/src/blocks/textarea.lite.tsx +2 -3
  34. package/src/blocks/video.js +97 -46
  35. package/src/blocks/video.lite.tsx +5 -6
  36. package/src/components/block-styles.js +5 -0
  37. package/src/components/block-styles.lite.tsx +6 -0
  38. package/src/components/error-boundary.js +27 -0
  39. package/src/components/error-boundary.lite.tsx +6 -0
  40. package/src/components/render-block.js +123 -38
  41. package/src/components/render-block.lite.tsx +70 -33
  42. package/src/components/render-blocks.js +61 -35
  43. package/src/components/render-blocks.lite.tsx +17 -14
  44. package/src/components/render-content.js +185 -36
  45. package/src/components/render-content.lite.tsx +144 -32
  46. package/src/constants/device-sizes.js +8 -11
  47. package/src/context/builder.context.js +2 -4
  48. package/src/functions/evaluate.js +18 -9
  49. package/src/functions/event-handler-name.js +6 -0
  50. package/src/functions/get-block-actions.js +13 -13
  51. package/src/functions/get-block-component-options.js +27 -4
  52. package/src/functions/get-block-properties.js +24 -16
  53. package/src/functions/get-block-styles.js +56 -9
  54. package/src/functions/get-block-tag.js +2 -4
  55. package/src/functions/get-content.js +72 -25
  56. package/src/functions/get-content.test.js +58 -0
  57. package/src/functions/get-fetch.js +11 -0
  58. package/src/functions/get-global-this.js +17 -0
  59. package/src/functions/get-processed-block.js +19 -13
  60. package/src/functions/get-processed-block.test.js +18 -14
  61. package/src/functions/get-target.js +3 -5
  62. package/src/functions/if-target.js +1 -3
  63. package/src/functions/is-browser.js +7 -5
  64. package/src/functions/is-editing.js +5 -5
  65. package/src/functions/is-iframe.js +2 -4
  66. package/src/functions/is-previewing.js +13 -0
  67. package/src/functions/is-react-native.js +2 -4
  68. package/src/functions/macro-eval.js +2 -5
  69. package/src/functions/on-change.js +4 -7
  70. package/src/functions/on-change.test.js +10 -10
  71. package/src/functions/previewing-model-name.js +10 -0
  72. package/src/functions/register-component.js +39 -27
  73. package/src/functions/register.js +28 -0
  74. package/src/functions/set-editor-settings.js +14 -0
  75. package/src/functions/set.js +14 -5
  76. package/src/functions/set.test.js +14 -14
  77. package/src/functions/track.js +6 -8
  78. package/src/functions/transform-block.js +40 -0
  79. package/src/index.js +18 -16
  80. package/src/scripts/init-editing.js +67 -29
  81. package/src/types/deep-partial.js +1 -0
  82. package/index.js +0 -11
  83. package/src/package.json +0 -18
@@ -4,81 +4,166 @@ 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) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __defNormalProp = (obj, key, value) =>
8
+ key in obj
9
+ ? __defProp(obj, key, {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value,
14
+ })
15
+ : (obj[key] = value);
8
16
  var __spreadValues = (a, b) => {
9
17
  for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
18
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
12
19
  if (__getOwnPropSymbols)
13
20
  for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
21
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
16
22
  }
17
23
  return a;
18
24
  };
19
25
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
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";
26
+ import * as React from 'react';
27
+ import { useContext } from 'react';
28
+ import { getBlockComponentOptions } from '../functions/get-block-component-options';
29
+ import { getBlockProperties } from '../functions/get-block-properties';
30
+ import { getBlockStyles } from '../functions/get-block-styles';
31
+ import { getBlockTag } from '../functions/get-block-tag';
32
+ import { components } from '../functions/register-component';
33
+ import BuilderContext from '../context/builder.context';
34
+ import { getBlockActions } from '../functions/get-block-actions';
35
+ import { getProcessedBlock } from '../functions/get-processed-block';
36
+ import BlockStyles from './block-styles';
37
+ import RenderBlocks from './render-blocks';
30
38
  function RenderBlock(props) {
31
39
  var _a, _b, _c;
32
40
  function component() {
33
- var _a2;
34
- return components[(_a2 = block().component) == null ? void 0 : _a2.name];
41
+ var _a2, _b2;
42
+ const componentName =
43
+ (_a2 = useBlock().component) == null ? void 0 : _a2.name;
44
+ if (!componentName) {
45
+ return null;
46
+ }
47
+ const ref =
48
+ components[(_b2 = useBlock().component) == null ? void 0 : _b2.name];
49
+ if (componentName && !ref) {
50
+ console.warn(`
51
+ Could not find a registered component named "${componentName}".
52
+ If you registered it, is the file that registered it imported by the file that needs to render it?`);
53
+ }
54
+ return ref;
35
55
  }
36
56
  function componentInfo() {
37
57
  var _a2;
38
- return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.info;
58
+ return (_a2 = component == null ? void 0 : component()) == null
59
+ ? void 0
60
+ : _a2.info;
39
61
  }
40
62
  function componentRef() {
41
63
  var _a2;
42
- return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component;
64
+ return (_a2 = component == null ? void 0 : component()) == null
65
+ ? void 0
66
+ : _a2.component;
43
67
  }
44
68
  function tagName() {
45
- return getBlockTag(block());
69
+ return getBlockTag(useBlock());
46
70
  }
47
71
  function properties() {
48
- return getBlockProperties(block());
72
+ return getBlockProperties(useBlock());
49
73
  }
50
- function block() {
74
+ function useBlock() {
51
75
  return getProcessedBlock({
52
76
  block: props.block,
53
77
  state: builderContext.state,
54
- context: builderContext.context
78
+ context: builderContext.context,
55
79
  });
56
80
  }
81
+ function propertiesAndActions() {
82
+ return __spreadValues(__spreadValues({}, properties()), actions());
83
+ }
57
84
  function actions() {
58
85
  return getBlockActions({
59
- block: block(),
86
+ block: useBlock(),
60
87
  state: builderContext.state,
61
- context: builderContext.context
88
+ context: builderContext.context,
62
89
  });
63
90
  }
64
91
  function css() {
65
- return getBlockStyles(block());
92
+ return getBlockStyles(useBlock());
66
93
  }
67
94
  function componentOptions() {
68
- return getBlockComponentOptions(block());
95
+ return getBlockComponentOptions(useBlock());
69
96
  }
70
97
  const builderContext = useContext(BuilderContext);
71
98
  const ComponentRefRef = componentRef();
72
99
  const TagNameRef = tagName();
73
- return /* @__PURE__ */ React.createElement(React.Fragment, null, ((_a = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a.noWrap) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, (_b = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _b.options), {
74
- attributes: properties(),
75
- style: css()
76
- }))), !((_c = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _c.noWrap) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadProps(__spreadValues({}, properties()), {
77
- style: css()
78
- }), componentRef() && /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadValues({}, componentOptions())), !componentRef() && block().children && block().children.length && /* @__PURE__ */ React.createElement(React.Fragment, null, block().children.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
79
- block: child
80
- }))))));
100
+ return /* @__PURE__ */ React.createElement(
101
+ React.Fragment,
102
+ null,
103
+ !((_a = componentInfo == null ? void 0 : componentInfo()) == null
104
+ ? void 0
105
+ : _a.noWrap)
106
+ ? /* @__PURE__ */ React.createElement(
107
+ React.Fragment,
108
+ null,
109
+ /* @__PURE__ */ React.createElement(
110
+ TagNameRef,
111
+ __spreadProps(__spreadValues({}, propertiesAndActions()), {
112
+ style: css(),
113
+ }),
114
+ /* @__PURE__ */ React.createElement(BlockStyles, {
115
+ block: useBlock(),
116
+ }),
117
+ componentRef()
118
+ ? /* @__PURE__ */ React.createElement(
119
+ ComponentRefRef,
120
+ __spreadProps(__spreadValues({}, componentOptions()), {
121
+ builderBlock: useBlock(),
122
+ }),
123
+ useBlock().children
124
+ ? /* @__PURE__ */ React.createElement(
125
+ React.Fragment,
126
+ null,
127
+ /* @__PURE__ */ React.createElement(RenderBlocks, {
128
+ path: 'children',
129
+ blocks: useBlock().children,
130
+ })
131
+ )
132
+ : null
133
+ )
134
+ : null,
135
+ !componentRef() && useBlock().children && useBlock().children.length
136
+ ? /* @__PURE__ */ React.createElement(
137
+ React.Fragment,
138
+ null,
139
+ (_b = useBlock().children) == null
140
+ ? void 0
141
+ : _b.map((child) =>
142
+ /* @__PURE__ */ React.createElement(RenderBlock, {
143
+ block: child,
144
+ })
145
+ )
146
+ )
147
+ : null
148
+ )
149
+ )
150
+ : /* @__PURE__ */ React.createElement(
151
+ ComponentRefRef,
152
+ __spreadProps(
153
+ __spreadValues(
154
+ {},
155
+ (_c = componentInfo == null ? void 0 : componentInfo()) == null
156
+ ? void 0
157
+ : _c.options
158
+ ),
159
+ {
160
+ attributes: propertiesAndActions(),
161
+ builderBlock: useBlock(),
162
+ style: css(),
163
+ children: useBlock().children,
164
+ }
165
+ )
166
+ )
167
+ );
81
168
  }
82
- export {
83
- RenderBlock as default
84
- };
169
+ export { RenderBlock as default };
@@ -1,18 +1,35 @@
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";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
3
+ import { 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';
12
14
 
13
15
  export default function RenderBlock(props) {
14
16
  function component() {
15
- return components[block().component?.name];
17
+ const componentName = useBlock().component?.name;
18
+
19
+ if (!componentName) {
20
+ return null;
21
+ }
22
+
23
+ const ref = components[useBlock().component?.name];
24
+
25
+ if (componentName && !ref) {
26
+ // TODO: Public doc page with more info about this message
27
+ console.warn(`
28
+ Could not find a registered component named "${componentName}".
29
+ If you registered it, is the file that registered it imported by the file that needs to render it?`);
30
+ }
31
+
32
+ return ref;
16
33
  }
17
34
 
18
35
  function componentInfo() {
@@ -24,14 +41,14 @@ export default function RenderBlock(props) {
24
41
  }
25
42
 
26
43
  function tagName() {
27
- return getBlockTag(block());
44
+ return getBlockTag(useBlock());
28
45
  }
29
46
 
30
47
  function properties() {
31
- return getBlockProperties(block());
48
+ return getBlockProperties(useBlock());
32
49
  }
33
50
 
34
- function block() {
51
+ function useBlock() {
35
52
  return getProcessedBlock({
36
53
  block: props.block,
37
54
  state: builderContext.state,
@@ -39,20 +56,24 @@ export default function RenderBlock(props) {
39
56
  });
40
57
  }
41
58
 
59
+ function propertiesAndActions() {
60
+ return { ...properties(), ...actions() };
61
+ }
62
+
42
63
  function actions() {
43
64
  return getBlockActions({
44
- block: block(),
65
+ block: useBlock(),
45
66
  state: builderContext.state,
46
67
  context: builderContext.context,
47
68
  });
48
69
  }
49
70
 
50
71
  function css() {
51
- return getBlockStyles(block());
72
+ return getBlockStyles(useBlock());
52
73
  }
53
74
 
54
75
  function componentOptions() {
55
- return getBlockComponentOptions(block());
76
+ return getBlockComponentOptions(useBlock());
56
77
  }
57
78
 
58
79
  const builderContext = useContext(BuilderContext);
@@ -62,30 +83,46 @@ export default function RenderBlock(props) {
62
83
 
63
84
  return (
64
85
  <>
65
- {componentInfo?.()?.noWrap && (
86
+ {!componentInfo?.()?.noWrap ? (
66
87
  <>
67
- <ComponentRefRef
68
- {...componentInfo?.()?.options}
69
- attributes={properties()}
70
- style={css()}
71
- />
72
- </>
73
- )}
88
+ <TagNameRef {...propertiesAndActions()} style={css()}>
89
+ <BlockStyles block={useBlock()} />
74
90
 
75
- {!componentInfo?.()?.noWrap && (
76
- <>
77
- <TagNameRef {...properties()} style={css()}>
78
- {componentRef() && <ComponentRefRef {...componentOptions()} />}
91
+ {componentRef() ? (
92
+ <ComponentRefRef
93
+ {...componentOptions()}
94
+ builderBlock={useBlock()}
95
+ >
96
+ {useBlock().children ? (
97
+ <>
98
+ <RenderBlocks
99
+ path="children"
100
+ blocks={useBlock().children}
101
+ />
102
+ </>
103
+ ) : null}
104
+ </ComponentRefRef>
105
+ ) : null}
79
106
 
80
- {!componentRef() && block().children && block().children.length && (
107
+ {!componentRef() &&
108
+ useBlock().children &&
109
+ useBlock().children.length ? (
81
110
  <>
82
- {block().children.map((child) => (
111
+ {useBlock().children?.map((child) => (
83
112
  <RenderBlock block={child} />
84
113
  ))}
85
114
  </>
86
- )}
115
+ ) : null}
87
116
  </TagNameRef>
88
117
  </>
118
+ ) : (
119
+ <ComponentRefRef
120
+ {...componentInfo?.()?.options}
121
+ attributes={propertiesAndActions()}
122
+ builderBlock={useBlock()}
123
+ style={css()}
124
+ children={useBlock().children}
125
+ />
89
126
  )}
90
127
  </>
91
128
  );
@@ -1,47 +1,73 @@
1
- import * as React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- import { isEditing } from "../functions/is-editing";
4
- import RenderBlock from "./render-block";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import { isEditing } from '../functions/is-editing';
4
+ import RenderBlock from './render-block';
5
5
  function RenderBlocks(props) {
6
- var _a;
6
+ var _a, _b;
7
7
  function onClick() {
8
- var _a2, _b;
8
+ var _a2, _b2;
9
9
  if (isEditing() && !((_a2 = props.blocks) == null ? void 0 : _a2.length)) {
10
- (_b = window.parent) == null ? void 0 : _b.postMessage({
11
- type: "builder.clickEmptyBlocks",
12
- data: {
13
- parentElementId: props.parent,
14
- dataPath: props.path
15
- }
16
- }, "*");
10
+ (_b2 = window.parent) == null
11
+ ? void 0
12
+ : _b2.postMessage(
13
+ {
14
+ type: 'builder.clickEmptyBlocks',
15
+ data: {
16
+ parentElementId: props.parent,
17
+ dataPath: props.path,
18
+ },
19
+ },
20
+ '*'
21
+ );
17
22
  }
18
23
  }
19
24
  function onMouseEnter() {
20
- var _a2, _b;
25
+ var _a2, _b2;
21
26
  if (isEditing() && !((_a2 = props.blocks) == null ? void 0 : _a2.length)) {
22
- (_b = window.parent) == null ? void 0 : _b.postMessage({
23
- type: "builder.hoverEmptyBlocks",
24
- data: {
25
- parentElementId: props.parent,
26
- dataPath: props.path
27
- }
28
- }, "*");
27
+ (_b2 = window.parent) == null
28
+ ? void 0
29
+ : _b2.postMessage(
30
+ {
31
+ type: 'builder.hoverEmptyBlocks',
32
+ data: {
33
+ parentElementId: props.parent,
34
+ dataPath: props.path,
35
+ },
36
+ },
37
+ '*'
38
+ );
29
39
  }
30
40
  }
31
- return /* @__PURE__ */ React.createElement(View, {
32
- className: "builder-blocks" + (!((_a = props.blocks) == null ? void 0 : _a.length) ? " no-blocks" : ""),
33
- "builder-path": props.path,
34
- "builder-parent-id": props.parent,
35
- onClick: (event) => onClick,
36
- onMouseEnter: (event) => onMouseEnter,
37
- style: styles.view1
38
- }, props.blocks.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
39
- block
40
- })));
41
+ return /* @__PURE__ */ React.createElement(
42
+ View,
43
+ {
44
+ 'builder-path': props.path,
45
+ 'builder-parent-id': props.parent,
46
+ onClick: (event) => onClick,
47
+ onMouseEnter: (event) => onMouseEnter,
48
+ className:
49
+ 'builder-blocks' +
50
+ (!((_a = props.blocks) == null ? void 0 : _a.length)
51
+ ? ' no-blocks'
52
+ : ''),
53
+ style: styles.view1,
54
+ },
55
+ props.blocks
56
+ ? /* @__PURE__ */ React.createElement(
57
+ React.Fragment,
58
+ null,
59
+ (_b = props.blocks) == null
60
+ ? void 0
61
+ : _b.map((block) =>
62
+ /* @__PURE__ */ React.createElement(RenderBlock, {
63
+ block,
64
+ })
65
+ )
66
+ )
67
+ : null
68
+ );
41
69
  }
42
70
  const styles = StyleSheet.create({
43
- view1: { display: "flex", flexDirection: "column", alignItems: "stretch" }
71
+ view1: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' },
44
72
  });
45
- export {
46
- RenderBlocks as default
47
- };
73
+ export { RenderBlocks as default };
@@ -1,21 +1,20 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useState, useContext } from "react";
4
- import { isEditing } from "../functions/is-editing";
5
- import RenderBlock from "./render-block.lite";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
3
+ import { isEditing } from '../functions/is-editing';
4
+ import RenderBlock from './render-block.lite';
6
5
 
7
6
  export default function RenderBlocks(props) {
8
7
  function onClick() {
9
8
  if (isEditing() && !props.blocks?.length) {
10
9
  window.parent?.postMessage(
11
10
  {
12
- type: "builder.clickEmptyBlocks",
11
+ type: 'builder.clickEmptyBlocks',
13
12
  data: {
14
13
  parentElementId: props.parent,
15
14
  dataPath: props.path,
16
15
  },
17
16
  },
18
- "*"
17
+ '*'
19
18
  );
20
19
  }
21
20
  }
@@ -24,33 +23,37 @@ export default function RenderBlocks(props) {
24
23
  if (isEditing() && !props.blocks?.length) {
25
24
  window.parent?.postMessage(
26
25
  {
27
- type: "builder.hoverEmptyBlocks",
26
+ type: 'builder.hoverEmptyBlocks',
28
27
  data: {
29
28
  parentElementId: props.parent,
30
29
  dataPath: props.path,
31
30
  },
32
31
  },
33
- "*"
32
+ '*'
34
33
  );
35
34
  }
36
35
  }
37
36
 
38
37
  return (
39
38
  <View
40
- className={"builder-blocks" + (!props.blocks?.length ? " no-blocks" : "")}
41
39
  builder-path={props.path}
42
40
  builder-parent-id={props.parent}
43
41
  onClick={(event) => onClick}
44
42
  onMouseEnter={(event) => onMouseEnter}
43
+ className={'builder-blocks' + (!props.blocks?.length ? ' no-blocks' : '')}
45
44
  style={styles.view1}
46
45
  >
47
- {props.blocks.map((block) => (
48
- <RenderBlock block={block} />
49
- ))}
46
+ {props.blocks ? (
47
+ <>
48
+ {props.blocks?.map((block) => (
49
+ <RenderBlock block={block} />
50
+ ))}
51
+ </>
52
+ ) : null}
50
53
  </View>
51
54
  );
52
55
  }
53
56
 
54
57
  const styles = StyleSheet.create({
55
- view1: { display: "flex", flexDirection: "column", alignItems: "stretch" },
58
+ view1: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' },
56
59
  });