@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.
Files changed (77) hide show
  1. package/package.json +3 -2
  2. package/src/blocks/button.js +66 -24
  3. package/src/blocks/button.lite.tsx +9 -13
  4. package/src/blocks/columns.js +247 -36
  5. package/src/blocks/columns.lite.tsx +7 -7
  6. package/src/blocks/custom-code.js +73 -47
  7. package/src/blocks/custom-code.lite.tsx +12 -16
  8. package/src/blocks/embed.js +66 -47
  9. package/src/blocks/embed.lite.tsx +11 -13
  10. package/src/blocks/form.js +436 -198
  11. package/src/blocks/form.lite.tsx +67 -78
  12. package/src/blocks/fragment.js +16 -11
  13. package/src/blocks/fragment.lite.tsx +8 -5
  14. package/src/blocks/image.js +89 -80
  15. package/src/blocks/image.lite.tsx +44 -13
  16. package/src/blocks/img.js +45 -28
  17. package/src/blocks/img.lite.tsx +7 -7
  18. package/src/blocks/input.js +93 -28
  19. package/src/blocks/input.lite.tsx +5 -9
  20. package/src/blocks/raw-text.js +16 -12
  21. package/src/blocks/raw-text.lite.tsx +3 -3
  22. package/src/blocks/section.js +66 -23
  23. package/src/blocks/section.lite.tsx +4 -4
  24. package/src/blocks/select.js +67 -28
  25. package/src/blocks/select.lite.tsx +6 -10
  26. package/src/blocks/submit-button.js +41 -21
  27. package/src/blocks/submit-button.lite.tsx +3 -3
  28. package/src/blocks/symbol.js +18 -16
  29. package/src/blocks/symbol.lite.tsx +5 -5
  30. package/src/blocks/text.js +29 -27
  31. package/src/blocks/text.lite.tsx +4 -9
  32. package/src/blocks/textarea.js +53 -24
  33. package/src/blocks/textarea.lite.tsx +3 -3
  34. package/src/blocks/video.js +112 -46
  35. package/src/blocks/video.lite.tsx +6 -6
  36. package/src/components/block-styles.js +2 -4
  37. package/src/components/block-styles.lite.tsx +3 -3
  38. package/src/components/error-boundary.js +11 -9
  39. package/src/components/error-boundary.lite.tsx +3 -3
  40. package/src/components/render-block.js +89 -36
  41. package/src/components/render-block.lite.tsx +47 -32
  42. package/src/components/render-blocks.js +56 -32
  43. package/src/components/render-blocks.lite.tsx +16 -16
  44. package/src/components/render-content.js +160 -36
  45. package/src/components/render-content.lite.tsx +139 -39
  46. package/src/constants/device-sizes.js +8 -11
  47. package/src/context/builder.context.js +2 -4
  48. package/src/functions/evaluate.js +17 -9
  49. package/src/functions/get-block-actions.js +9 -10
  50. package/src/functions/get-block-component-options.js +11 -10
  51. package/src/functions/get-block-properties.js +15 -17
  52. package/src/functions/get-block-styles.js +25 -17
  53. package/src/functions/get-block-tag.js +2 -4
  54. package/src/functions/get-content.js +54 -27
  55. package/src/functions/get-fetch.js +11 -0
  56. package/src/functions/get-global-this.js +17 -0
  57. package/src/functions/get-processed-block.js +11 -13
  58. package/src/functions/get-processed-block.test.js +14 -14
  59. package/src/functions/get-target.js +3 -5
  60. package/src/functions/if-target.js +1 -3
  61. package/src/functions/is-browser.js +3 -5
  62. package/src/functions/is-editing.js +3 -5
  63. package/src/functions/is-iframe.js +2 -4
  64. package/src/functions/is-previewing.js +13 -0
  65. package/src/functions/is-react-native.js +2 -4
  66. package/src/functions/macro-eval.js +2 -5
  67. package/src/functions/on-change.js +4 -7
  68. package/src/functions/on-change.test.js +10 -10
  69. package/src/functions/previewing-model-name.js +10 -0
  70. package/src/functions/register-component.js +34 -28
  71. package/src/functions/register.js +8 -10
  72. package/src/functions/set-editor-settings.js +5 -7
  73. package/src/functions/set.js +10 -4
  74. package/src/functions/set.test.js +14 -14
  75. package/src/functions/track.js +6 -8
  76. package/src/index.js +18 -20
  77. package/src/scripts/init-editing.js +65 -31
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
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 (
@@ -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
- var _a;
26
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
27
- preload: "none",
28
- style: __spreadProps(__spreadValues({
29
- width: "100%",
30
- height: "100%"
31
- }, (_a = props.attributes) == null ? void 0 : _a.style), {
32
- objectFit: props.fit,
33
- objectPosition: props.position,
34
- borderRadius: 1
35
- }),
36
- key: props.video || "no-src",
37
- poster: props.posterImage,
38
- autoPlay: props.autoPlay,
39
- muted: props.muted,
40
- controls: props.controls,
41
- loop: props.loop
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
- export {
45
- Video as default
46
- };
47
-
48
-
49
- registerComponent(Video, {name:'Video',canHaveChildren:true,defaultStyles:{minHeight:'20px',minWidth:'20px'},image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb',inputs:[{name:'video',type:'file',allowedFileTypes:['mp4'],bubble:true,defaultValue:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',required:true,onChange:" const 0.7004048582995948 = 0.7004048582995948; function loadImage(url: string, timeout = 60000): Promise<HTMLImageElement> { return new Promise((resolve, reject) => { const img = document.createElement('img'); let loaded = false; img.onload = () => { loaded = true; resolve(img); }; img.addEventListener('error', event => { console.warn('Image load failed', event.error); reject(event.error); }); img.src = url; setTimeout(() => { if (!loaded) { reject(new Error('Image load timed out')); } }, timeout); }); } function round(num: number) { return Math.round(num * 1000) / 1000; } // TODO const value = options.get('image'); const aspectRatio = options.get('aspectRatio'); if (value && (!aspectRatio || aspectRatio === 0.7004048582995948)) { return loadImage(value).then(img => { const possiblyUpdatedAspectRatio = options.get('aspectRatio'); if ( options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === 0.7004048582995948) ) { if (img.width && img.height) { options.set('aspectRatio', round(img.height / img.width)); } } }); } "},{name:'posterImage',type:'file',allowedFileTypes:['jpeg','png'],helperText:'Image to show before the video plays'},{name:'autoPlay',type:'boolean',defaultValue:true},{name:'controls',type:'boolean',defaultValue:false},{name:'muted',type:'boolean',defaultValue:true},{name:'loop',type:'boolean',defaultValue:true},{name:'playsInline',type:'boolean',defaultValue:true},{name:'fit',type:'text',defaultValue:'cover',enum:['contain','cover','fill','auto']},{name:'fitContent',type:'boolean',helperText:'When child blocks are provided, fit to them instead of using the aspect ratio',defaultValue:true,advanced:true},{name:'position',type:'text',defaultValue:'center',enum:['center','top','left','right','bottom','top left','top right','bottom left','bottom right']},{name:'height',type:'number',advanced:true},{name:'width',type:'number',advanced:true},{name:'aspectRatio',type:'number',advanced:true,defaultValue:0.7004048582995948},{name:'lazyLoad',type:'boolean',helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:true,advanced:true}]});
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 "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
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: "100%",
12
- height: "100%",
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 || "no-src"}
20
+ key={props.video || 'no-src'}
21
21
  poster={props.posterImage}
22
22
  autoPlay={props.autoPlay}
23
23
  muted={props.muted}
@@ -1,7 +1,5 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  function BlockStyles(props) {
3
3
  return /* @__PURE__ */ React.createElement(React.Fragment, null);
4
4
  }
5
- export {
6
- BlockStyles as default
7
- };
5
+ export { BlockStyles as default };
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
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 "react";
2
- import { Text } from "react-native";
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("Error rendering Builder.io block", error, errorInfo);
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(Text, {
17
- style: { color: "gray" }
18
- }, "Error rendering Builder.io block");
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 "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useContext } from "react";
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) => 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, { 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 "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";
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, _b;
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[(_b = useBlock().component) == null ? void 0 : _b.name];
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
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadProps(__spreadValues({}, properties()), {
85
- style: css()
86
- }), /* @__PURE__ */ React.createElement(BlockStyles, {
87
- block: useBlock()
88
- }), componentRef() && /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, componentOptions()), {
89
- builderBlock: useBlock(),
90
- children: useBlock().children
91
- })), !componentRef() && useBlock().children && useBlock().children.length && /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = useBlock().children) == null ? void 0 : _a.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
92
- block: child
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 "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";
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
- <TagNameRef {...properties()} style={css()}>
82
- <BlockStyles block={useBlock()} />
83
-
84
- {componentRef() && (
85
- <ComponentRefRef
86
- {...componentOptions()}
87
- builderBlock={useBlock()}
88
- children={useBlock().children}
89
- />
90
- )}
91
-
92
- {!componentRef() && useBlock().children && useBlock().children.length && (
93
- <>
94
- {useBlock().children?.map((child) => (
95
- <RenderBlock block={child} />
96
- ))}
97
- </>
98
- )}
99
- </TagNameRef>
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
  }