@builder.io/sdk-react-native 0.1.10-0 → 0.1.10

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 (36) hide show
  1. package/dist/blocks/button/button.js +1 -1
  2. package/dist/blocks/columns/columns.js +17 -17
  3. package/dist/blocks/form/form.js +2 -2
  4. package/dist/blocks/image/component-info.js +1 -1
  5. package/dist/components/render-blocks.js +2 -2
  6. package/dist/components/render-content/components/render-styles.js +13 -0
  7. package/dist/components/render-content/render-content.js +4 -8
  8. package/dist/functions/is-editing.js +2 -1
  9. package/dist/index.js +0 -1
  10. package/package.json +1 -1
  11. package/src/blocks/button/button.jsx +3 -1
  12. package/src/blocks/columns/columns.jsx +20 -18
  13. package/src/blocks/custom-code/custom-code.jsx +3 -1
  14. package/src/blocks/embed/embed.jsx +3 -1
  15. package/src/blocks/form/form.jsx +3 -2
  16. package/src/blocks/fragment/fragment.jsx +3 -1
  17. package/src/blocks/image/component-info.js +1 -1
  18. package/src/blocks/img/img.jsx +3 -1
  19. package/src/blocks/input/input.jsx +3 -1
  20. package/src/blocks/raw-text/raw-text.jsx +3 -1
  21. package/src/blocks/section/section.jsx +3 -1
  22. package/src/blocks/select/select.jsx +3 -1
  23. package/src/blocks/submit-button/submit-button.jsx +3 -1
  24. package/src/blocks/symbol/symbol.jsx +3 -1
  25. package/src/blocks/textarea/textarea.jsx +3 -1
  26. package/src/components/render-block/block-styles.jsx +3 -1
  27. package/src/components/render-block/render-block.jsx +3 -1
  28. package/src/components/render-block/render-component.jsx +3 -1
  29. package/src/components/render-block/render-repeated-block.jsx +3 -1
  30. package/src/components/render-blocks.jsx +4 -2
  31. package/src/components/render-content/builder-editing.jsx +3 -1
  32. package/src/components/render-content/components/render-styles.jsx +16 -1
  33. package/src/components/render-content/render-content.jsx +13 -16
  34. package/src/components/render-inlined-styles.jsx +3 -1
  35. package/src/functions/is-editing.js +2 -1
  36. package/src/index.js +0 -1
@@ -35,5 +35,5 @@ function Button(props) {
35
35
  React.createElement(BaseText_1.default, null, props.text)))) : (React.createElement(react_native_1.View, { ...props.attributes, style: styles.view1 },
36
36
  React.createElement(BaseText_1.default, null, props.text)))));
37
37
  }
38
- exports.default = Button;
39
38
  const styles = react_native_1.StyleSheet.create({ view1: { all: "unset" } });
39
+ exports.default = Button;
@@ -110,26 +110,26 @@ function Columns(props) {
110
110
  }
111
111
  function columnsStyles() {
112
112
  return `
113
- @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
114
- .${props.builderBlock.id}-breakpoints {
115
- ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().columns.medium)}
116
- }
113
+ @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
114
+ .${props.builderBlock.id}-breakpoints {
115
+ ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().columns.medium)}
116
+ }
117
117
 
118
- .${props.builderBlock.id}-breakpoints > .builder-column {
119
- ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().column.medium)}
120
- }
118
+ .${props.builderBlock.id}-breakpoints > .builder-column {
119
+ ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().column.medium)}
121
120
  }
121
+ }
122
122
 
123
- @media (max-width: ${getWidthForBreakpointSize("small")}px) {
124
- .${props.builderBlock.id}-breakpoints {
125
- ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().columns.small)}
126
- }
123
+ @media (max-width: ${getWidthForBreakpointSize("small")}px) {
124
+ .${props.builderBlock.id}-breakpoints {
125
+ ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().columns.small)}
126
+ }
127
127
 
128
- .${props.builderBlock.id}-breakpoints > .builder-column {
129
- ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().column.small)}
130
- }
131
- },
132
- `;
128
+ .${props.builderBlock.id}-breakpoints > .builder-column {
129
+ ${(0, css_1.convertStyleMapToCSS)(columnStyleObjects().column.small)}
130
+ }
131
+ },
132
+ `;
133
133
  }
134
134
  function reactNativeColumnsStyles() {
135
135
  return columnStyleObjects.columns.small;
@@ -146,8 +146,8 @@ function Columns(props) {
146
146
  flexGrow: "1",
147
147
  } }))))));
148
148
  }
149
- exports.default = Columns;
150
149
  const styles = react_native_1.StyleSheet.create({
151
150
  view1: { display: "flex" },
152
151
  view2: { display: "flex", flexDirection: "column", alignItems: "stretch" },
153
152
  });
153
+ exports.default = Columns;
@@ -154,7 +154,7 @@ function FormComponent(props) {
154
154
  /* TODO: allow supplying an error formatter function */ let message = get(body, props.errorMessagePath);
155
155
  if (message) {
156
156
  if (typeof message !== "string") {
157
- /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
157
+ /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
158
158
  JSON.stringify(message);
159
159
  }
160
160
  setFormErrorMessage(message);
@@ -226,7 +226,7 @@ function FormComponent(props) {
226
226
  React.createElement(render_blocks_1.default, { dataPath: "successMessage", blocks: props.successMessage }))) : null,
227
227
  " "));
228
228
  }
229
- exports.default = FormComponent;
230
229
  const styles = react_native_1.StyleSheet.create({
231
230
  view1: { padding: 10, color: "red", textAlign: "center" },
232
231
  });
232
+ exports.default = FormComponent;
@@ -20,7 +20,7 @@ const componentInfo = {
20
20
  bubble: true,
21
21
  allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
22
22
  required: true,
23
- defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
23
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
24
24
  onChange: (0, util_js_1.serializeFn)((options) => {
25
25
  const DEFAULT_ASPECT_RATIO = 0.7041;
26
26
  options.delete("srcset");
@@ -66,11 +66,10 @@ function RenderBlocks(props) {
66
66
  const builderContext = (0, react_1.useContext)(builder_context_js_1.default);
67
67
  return (React.createElement(react_native_1.ScrollView, { "builder-path": props.path, "builder-parent-id": props.parent, dataSet: {
68
68
  class: className(),
69
- }, style: styles.scrollView1, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter() },
69
+ }, contentContainerStyle: styles.scrollView1, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter() },
70
70
  props.blocks ? (React.createElement(React.Fragment, null, (_a = props.blocks) === null || _a === void 0 ? void 0 : _a.map((block) => (React.createElement(render_block_1.default, { key: "render-block-" + block.id, block: block, context: builderContext }))))) : null,
71
71
  props.blocks ? (React.createElement(React.Fragment, null, (_b = props.blocks) === null || _b === void 0 ? void 0 : _b.map((block) => (React.createElement(block_styles_1.default, { key: "block-style-" + block.id, block: block, context: builderContext }))))) : null));
72
72
  }
73
- exports.default = RenderBlocks;
74
73
  const styles = react_native_1.StyleSheet.create({
75
74
  scrollView1: {
76
75
  display: "flex",
@@ -78,3 +77,4 @@ const styles = react_native_1.StyleSheet.create({
78
77
  alignItems: "stretch",
79
78
  },
80
79
  });
80
+ exports.default = RenderBlocks;
@@ -41,6 +41,19 @@ ${(0, render_styles_helpers_1.getCss)({
41
41
  ${(0, render_styles_helpers_2.getFontCss)({
42
42
  customFonts: props.customFonts,
43
43
  })}
44
+
45
+ .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
46
+ margin: 0;
47
+ }
48
+ .builder-text > p, .builder-text > .builder-paragraph {
49
+ color: inherit;
50
+ line-height: inherit;
51
+ letter-spacing: inherit;
52
+ font-weight: inherit;
53
+ font-size: inherit;
54
+ text-align: inherit;
55
+ font-family: inherit;
56
+ }
44
57
  `);
45
58
  return React.createElement(render_inlined_styles_1.default, { styles: injectedStyles });
46
59
  }
@@ -30,7 +30,6 @@ const React = __importStar(require("react"));
30
30
  const react_native_1 = require("react-native");
31
31
  const react_1 = require("react");
32
32
  const builder_registered_components_js_1 = require("../../constants/builder-registered-components.js");
33
- const target_js_1 = require("../../constants/target.js");
34
33
  const evaluate_js_1 = require("../../functions/evaluate.js");
35
34
  const index_js_1 = require("../../functions/get-content/index.js");
36
35
  const get_fetch_js_1 = require("../../functions/get-fetch.js");
@@ -46,6 +45,7 @@ const init_editing_js_1 = require("../../scripts/init-editing.js");
46
45
  const nullable_js_1 = require("../../helpers/nullable.js");
47
46
  const interaction_js_1 = require("../../functions/track/interaction.js");
48
47
  const render_content_helpers_js_1 = require("./render-content.helpers.js");
48
+ const target_js_1 = require("../../constants/target.js");
49
49
  function RenderContent(props) {
50
50
  var _a, _b, _c, _d, _e;
51
51
  const elementRef = (0, react_1.useRef)(null);
@@ -217,11 +217,6 @@ function RenderContent(props) {
217
217
  }));
218
218
  }
219
219
  }
220
- function shouldRenderContentStyles() {
221
- var _a, _b, _c;
222
- return Boolean((((_a = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _a === void 0 ? void 0 : _a.cssCode) || ((_c = (_b = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _b === void 0 ? void 0 : _b.customFonts) === null || _c === void 0 ? void 0 : _c.length)) &&
223
- target_js_1.TARGET !== "reactNative");
224
- }
225
220
  (0, react_1.useEffect)(() => {
226
221
  if (!props.apiKey) {
227
222
  console.error("[Builder.io]: No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
@@ -268,7 +263,7 @@ function RenderContent(props) {
268
263
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
269
264
  /**
270
265
  * Make sure that:
271
- * - the preview model name is the same as the one we're rendering, since there can be multiple models rendered * at the same time, e.g. header/page/footer. * - the API key is the same, since we don't want to preview content from other organizations.
266
+ * - the preview model name is the same as the one we're rendering, since there can be multiple models rendered * at the same time, e.g. header/page/footer. * - the API key is the same, since we don't want to preview content from other organizations.
272
267
  *
273
268
  * TO-DO: should we check that the preview item ID is the same as the initial one being rendered? Or would
274
269
  * this break scenarios where the item is not published yet?
@@ -318,7 +313,8 @@ function RenderContent(props) {
318
313
  registeredComponents: allRegisteredComponents,
319
314
  } }, useContent ? (React.createElement(React.Fragment, null,
320
315
  React.createElement(react_native_1.ScrollView, { ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": useContent === null || useContent === void 0 ? void 0 : useContent.id, "builder-model": props.model },
321
- shouldRenderContentStyles() ? (React.createElement(render_styles_1.default, { contentId: useContent === null || useContent === void 0 ? void 0 : useContent.id, cssCode: (_c = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _c === void 0 ? void 0 : _c.cssCode, customFonts: (_d = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _d === void 0 ? void 0 : _d.customFonts })) : null,
316
+ target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
317
+ React.createElement(render_styles_1.default, { contentId: useContent === null || useContent === void 0 ? void 0 : useContent.id, cssCode: (_c = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _c === void 0 ? void 0 : _c.cssCode, customFonts: (_d = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _d === void 0 ? void 0 : _d.customFonts }))) : null,
322
318
  React.createElement(render_blocks_1.default, { blocks: (_e = useContent === null || useContent === void 0 ? void 0 : useContent.data) === null || _e === void 0 ? void 0 : _e.blocks, key: forceReRenderCount })))) : null));
323
319
  }
324
320
  exports.default = RenderContent;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isEditing = void 0;
4
+ const target_js_1 = require("../constants/target.js");
4
5
  const is_iframe_js_1 = require("./is-iframe.js");
5
6
  function isEditing() {
6
- return (0, is_iframe_js_1.isIframe)() && window.location.search.indexOf("builder.frameEditing=") !== -1;
7
+ return (0, is_iframe_js_1.isIframe)() && (target_js_1.TARGET === "reactNative" || window.location.search.indexOf("builder.frameEditing=") !== -1);
7
8
  }
8
9
  exports.isEditing = isEditing;
package/dist/index.js CHANGED
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.track = void 0;
18
18
  __exportStar(require("./index-helpers/top-of-file.js"), exports);
19
- require("./scripts/init-editing.js");
20
19
  __exportStar(require("./index-helpers/blocks-exports.js"), exports);
21
20
  __exportStar(require("./functions/is-editing.js"), exports);
22
21
  __exportStar(require("./functions/is-previewing.js"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-react-native",
3
3
  "description": "Builder.io SDK for React Native",
4
- "version": "0.1.10-0",
4
+ "version": "0.1.10",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -9,7 +9,7 @@ import {
9
9
  Text,
10
10
  } from "react-native";
11
11
 
12
- export default function Button(props) {
12
+ function Button(props) {
13
13
  return (
14
14
  <>
15
15
  {props.link ? (
@@ -33,3 +33,5 @@ export default function Button(props) {
33
33
  }
34
34
 
35
35
  const styles = StyleSheet.create({ view1: { all: "unset" } });
36
+
37
+ export default Button;
@@ -15,7 +15,7 @@ import { TARGET } from "../../constants/target.js";
15
15
  import { convertStyleMapToCSS } from "../../helpers/css";
16
16
  import BuilderContext from "../../context/builder.context.js";
17
17
 
18
- export default function Columns(props) {
18
+ function Columns(props) {
19
19
  function getGutterSize() {
20
20
  return typeof props.space === "number" ? props.space || 0 : 20;
21
21
  }
@@ -99,26 +99,26 @@ export default function Columns(props) {
99
99
 
100
100
  function columnsStyles() {
101
101
  return `
102
- @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
103
- .${props.builderBlock.id}-breakpoints {
104
- ${convertStyleMapToCSS(columnStyleObjects().columns.medium)}
105
- }
106
-
107
- .${props.builderBlock.id}-breakpoints > .builder-column {
108
- ${convertStyleMapToCSS(columnStyleObjects().column.medium)}
109
- }
102
+ @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
103
+ .${props.builderBlock.id}-breakpoints {
104
+ ${convertStyleMapToCSS(columnStyleObjects().columns.medium)}
110
105
  }
111
106
 
112
- @media (max-width: ${getWidthForBreakpointSize("small")}px) {
113
- .${props.builderBlock.id}-breakpoints {
114
- ${convertStyleMapToCSS(columnStyleObjects().columns.small)}
115
- }
107
+ .${props.builderBlock.id}-breakpoints > .builder-column {
108
+ ${convertStyleMapToCSS(columnStyleObjects().column.medium)}
109
+ }
110
+ }
116
111
 
117
- .${props.builderBlock.id}-breakpoints > .builder-column {
118
- ${convertStyleMapToCSS(columnStyleObjects().column.small)}
119
- }
120
- },
121
- `;
112
+ @media (max-width: ${getWidthForBreakpointSize("small")}px) {
113
+ .${props.builderBlock.id}-breakpoints {
114
+ ${convertStyleMapToCSS(columnStyleObjects().columns.small)}
115
+ }
116
+
117
+ .${props.builderBlock.id}-breakpoints > .builder-column {
118
+ ${convertStyleMapToCSS(columnStyleObjects().column.small)}
119
+ }
120
+ },
121
+ `;
122
122
  }
123
123
 
124
124
  function reactNativeColumnsStyles() {
@@ -159,3 +159,5 @@ const styles = StyleSheet.create({
159
159
  view1: { display: "flex" },
160
160
  view2: { display: "flex", flexDirection: "column", alignItems: "stretch" },
161
161
  });
162
+
163
+ export default Columns;
@@ -9,7 +9,7 @@ import {
9
9
  } from "react-native";
10
10
  import { useState, useRef, useEffect } from "react";
11
11
 
12
- export default function CustomCode(props) {
12
+ function CustomCode(props) {
13
13
  const elem = useRef(null);
14
14
  const [scriptsInserted, setScriptsInserted] = useState(() => []);
15
15
 
@@ -62,3 +62,5 @@ export default function CustomCode(props) {
62
62
 
63
63
  return <View ref={elem} dangerouslySetInnerHTML={{ __html: props.code }} />;
64
64
  }
65
+
66
+ export default CustomCode;
@@ -10,7 +10,7 @@ import {
10
10
  import { useState, useRef, useEffect } from "react";
11
11
  import { isJsScript } from "./helpers.js";
12
12
 
13
- export default function Embed(props) {
13
+ function Embed(props) {
14
14
  const elem = useRef(null);
15
15
  const [scriptsInserted, setScriptsInserted] = useState(() => []);
16
16
 
@@ -51,3 +51,5 @@ export default function Embed(props) {
51
51
  <View ref={elem} dangerouslySetInnerHTML={{ __html: props.content }} />
52
52
  );
53
53
  }
54
+
55
+ export default Embed;
@@ -13,7 +13,7 @@ import RenderBlock from "../../components/render-block/render-block";
13
13
  import BuilderBlocks from "../../components/render-blocks";
14
14
  import { isEditing } from "../../functions/is-editing.js";
15
15
 
16
- export default function FormComponent(props) {
16
+ function FormComponent(props) {
17
17
  const formRef = useRef(null);
18
18
  const [formState, setFormState] = useState(() => "unsubmitted");
19
19
 
@@ -146,7 +146,7 @@ export default function FormComponent(props) {
146
146
  get(body, props.errorMessagePath);
147
147
  if (message) {
148
148
  if (typeof message !== "string") {
149
- /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
149
+ /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
150
150
  JSON.stringify(message);
151
151
  }
152
152
  setFormErrorMessage(message);
@@ -256,3 +256,4 @@ export default function FormComponent(props) {
256
256
  const styles = StyleSheet.create({
257
257
  view1: { padding: 10, color: "red", textAlign: "center" },
258
258
  });
259
+ export default FormComponent;
@@ -9,10 +9,12 @@ import {
9
9
  Text,
10
10
  } from "react-native";
11
11
 
12
- export default function FragmentComponent(props) {
12
+ function FragmentComponent(props) {
13
13
  return (
14
14
  <View>
15
15
  <BaseText>{props.children}</BaseText>
16
16
  </View>
17
17
  );
18
18
  }
19
+
20
+ export default FragmentComponent;
@@ -17,7 +17,7 @@ const componentInfo = {
17
17
  bubble: true,
18
18
  allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
19
19
  required: true,
20
- defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
20
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
21
21
  onChange: serializeFn((options) => {
22
22
  const DEFAULT_ASPECT_RATIO = 0.7041;
23
23
  options.delete("srcset");
@@ -9,7 +9,7 @@ import {
9
9
  } from "react-native";
10
10
  import { isEditing } from "../../functions/is-editing.js";
11
11
 
12
- export default function ImgComponent(props) {
12
+ function ImgComponent(props) {
13
13
  return (
14
14
  <View
15
15
  style={{
@@ -23,3 +23,5 @@ export default function ImgComponent(props) {
23
23
  />
24
24
  );
25
25
  }
26
+
27
+ export default ImgComponent;
@@ -9,7 +9,7 @@ import {
9
9
  } from "react-native";
10
10
  import { isEditing } from "../../functions/is-editing.js";
11
11
 
12
- export default function FormInputComponent(props) {
12
+ function FormInputComponent(props) {
13
13
  return (
14
14
  <View
15
15
  {...props.attributes}
@@ -25,3 +25,5 @@ export default function FormInputComponent(props) {
25
25
  />
26
26
  );
27
27
  }
28
+
29
+ export default FormInputComponent;
@@ -8,6 +8,8 @@ import {
8
8
  Text,
9
9
  } from "react-native";
10
10
 
11
- export default function RawText(props) {
11
+ function RawText(props) {
12
12
  return <View dangerouslySetInnerHTML={{ __html: props.text || "" }} />;
13
13
  }
14
+
15
+ export default RawText;
@@ -9,7 +9,7 @@ import {
9
9
  Text,
10
10
  } from "react-native";
11
11
 
12
- export default function SectionComponent(props) {
12
+ function SectionComponent(props) {
13
13
  return (
14
14
  <View
15
15
  {...props.attributes}
@@ -30,3 +30,5 @@ export default function SectionComponent(props) {
30
30
  </View>
31
31
  );
32
32
  }
33
+
34
+ export default SectionComponent;
@@ -10,7 +10,7 @@ import {
10
10
  } from "react-native";
11
11
  import { isEditing } from "../../functions/is-editing.js";
12
12
 
13
- export default function SelectComponent(props) {
13
+ function SelectComponent(props) {
14
14
  return (
15
15
  <View
16
16
  {...props.attributes}
@@ -29,3 +29,5 @@ export default function SelectComponent(props) {
29
29
  </View>
30
30
  );
31
31
  }
32
+
33
+ export default SelectComponent;
@@ -9,10 +9,12 @@ import {
9
9
  Text,
10
10
  } from "react-native";
11
11
 
12
- export default function SubmitButton(props) {
12
+ function SubmitButton(props) {
13
13
  return (
14
14
  <View type="submit" {...props.attributes}>
15
15
  <BaseText>{props.text}</BaseText>
16
16
  </View>
17
17
  );
18
18
  }
19
+
20
+ export default SubmitButton;
@@ -13,7 +13,7 @@ import BuilderContext from "../../context/builder.context.js";
13
13
  import { getContent } from "../../functions/get-content/index.js";
14
14
  import { TARGET } from "../../constants/target";
15
15
 
16
- export default function Symbol(props) {
16
+ function Symbol(props) {
17
17
  function className() {
18
18
  return [
19
19
  ...(TARGET === "vue2" || TARGET === "vue3"
@@ -91,3 +91,5 @@ export default function Symbol(props) {
91
91
  </View>
92
92
  );
93
93
  }
94
+
95
+ export default Symbol;
@@ -8,7 +8,7 @@ import {
8
8
  Text,
9
9
  } from "react-native";
10
10
 
11
- export default function Textarea(props) {
11
+ function Textarea(props) {
12
12
  return (
13
13
  <View
14
14
  {...props.attributes}
@@ -19,3 +19,5 @@ export default function Textarea(props) {
19
19
  />
20
20
  );
21
21
  }
22
+
23
+ export default Textarea;
@@ -17,7 +17,7 @@ import { createCssClass } from "../../helpers/css.js";
17
17
  import { checkIsDefined } from "../../helpers/nullable.js";
18
18
  import RenderInlinedStyles from "../render-inlined-styles";
19
19
 
20
- export default function BlockStyles(props) {
20
+ function BlockStyles(props) {
21
21
  function useBlock() {
22
22
  return getProcessedBlock({
23
23
  block: props.block,
@@ -87,3 +87,5 @@ export default function BlockStyles(props) {
87
87
  </>
88
88
  );
89
89
  }
90
+
91
+ export default BlockStyles;
@@ -26,7 +26,7 @@ import RenderComponent from "./render-component";
26
26
  import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
27
27
  import { checkIsDefined } from "../../helpers/nullable.js";
28
28
 
29
- export default function RenderBlock(props) {
29
+ function RenderBlock(props) {
30
30
  const [component, setComponent] = useState(() =>
31
31
  getComponent({
32
32
  block: props.block,
@@ -223,3 +223,5 @@ export default function RenderBlock(props) {
223
223
  </>
224
224
  );
225
225
  }
226
+
227
+ export default RenderBlock;
@@ -12,7 +12,7 @@ import BlockStyles from "./block-styles";
12
12
  import RenderBlock from "./render-block";
13
13
  import BuilderContext from "../../context/builder.context.js";
14
14
 
15
- export default function RenderComponent(props) {
15
+ function RenderComponent(props) {
16
16
  const ComponentRefRef = props.componentRef;
17
17
 
18
18
  return (
@@ -50,3 +50,5 @@ export default function RenderComponent(props) {
50
50
  </BuilderContext.Provider>
51
51
  );
52
52
  }
53
+
54
+ export default RenderComponent;
@@ -11,7 +11,7 @@ import { useContext } from "react";
11
11
  import BuilderContext from "../../context/builder.context.js";
12
12
  import RenderBlock from "./render-block";
13
13
 
14
- export default function RenderRepeatedBlock(props) {
14
+ function RenderRepeatedBlock(props) {
15
15
  return (
16
16
  <BuilderContext.Provider
17
17
  value={{
@@ -28,3 +28,5 @@ export default function RenderRepeatedBlock(props) {
28
28
  </BuilderContext.Provider>
29
29
  );
30
30
  }
31
+
32
+ export default RenderRepeatedBlock;
@@ -13,7 +13,7 @@ import { isEditing } from "../functions/is-editing.js";
13
13
  import BlockStyles from "./render-block/block-styles";
14
14
  import RenderBlock from "./render-block/render-block";
15
15
 
16
- export default function RenderBlocks(props) {
16
+ function RenderBlocks(props) {
17
17
  function className() {
18
18
  return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
19
19
  }
@@ -57,7 +57,7 @@ export default function RenderBlocks(props) {
57
57
  dataSet={{
58
58
  class: className(),
59
59
  }}
60
- style={styles.scrollView1}
60
+ contentContainerStyle={styles.scrollView1}
61
61
  onClick={(event) => onClick()}
62
62
  onMouseEnter={(event) => onMouseEnter()}
63
63
  >
@@ -95,3 +95,5 @@ const styles = StyleSheet.create({
95
95
  alignItems: "stretch",
96
96
  },
97
97
  });
98
+
99
+ export default RenderBlocks;
@@ -8,6 +8,8 @@ import {
8
8
  Text,
9
9
  } from "react-native";
10
10
 
11
- export default function BuilderEditing(props) {
11
+ function BuilderEditing(props) {
12
12
  return <View />;
13
13
  }
14
+
15
+ export default BuilderEditing;
@@ -12,7 +12,7 @@ import RenderInlinedStyles from "../../render-inlined-styles";
12
12
  import { getCss } from "./render-styles.helpers";
13
13
  import { getFontCss } from "./render-styles.helpers";
14
14
 
15
- export default function RenderContentStyles(props) {
15
+ function RenderContentStyles(props) {
16
16
  const [injectedStyles, setInjectedStyles] = useState(
17
17
  () => `
18
18
  ${getCss({
@@ -22,8 +22,23 @@ ${getCss({
22
22
  ${getFontCss({
23
23
  customFonts: props.customFonts,
24
24
  })}
25
+
26
+ .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
27
+ margin: 0;
28
+ }
29
+ .builder-text > p, .builder-text > .builder-paragraph {
30
+ color: inherit;
31
+ line-height: inherit;
32
+ letter-spacing: inherit;
33
+ font-weight: inherit;
34
+ font-size: inherit;
35
+ text-align: inherit;
36
+ font-family: inherit;
37
+ }
25
38
  `
26
39
  );
27
40
 
28
41
  return <RenderInlinedStyles styles={injectedStyles} />;
29
42
  }
43
+
44
+ export default RenderContentStyles;
@@ -9,7 +9,6 @@ import {
9
9
  } from "react-native";
10
10
  import { useState, useContext, useRef, useEffect } from "react";
11
11
  import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
12
- import { TARGET } from "../../constants/target.js";
13
12
  import { evaluate } from "../../functions/evaluate.js";
14
13
  import { getContent } from "../../functions/get-content/index.js";
15
14
  import { fetch } from "../../functions/get-fetch.js";
@@ -34,8 +33,9 @@ import {
34
33
  getContentInitialValue,
35
34
  getContextStateInitialValue,
36
35
  } from "./render-content.helpers.js";
36
+ import { TARGET } from "../../constants/target.js";
37
37
 
38
- export default function RenderContent(props) {
38
+ function RenderContent(props) {
39
39
  const elementRef = useRef(null);
40
40
  const [forceReRenderCount, setForceReRenderCount] = useState(() => 0);
41
41
 
@@ -239,13 +239,6 @@ export default function RenderContent(props) {
239
239
  }
240
240
  }
241
241
 
242
- function shouldRenderContentStyles() {
243
- return Boolean(
244
- (useContent?.data?.cssCode || useContent?.data?.customFonts?.length) &&
245
- TARGET !== "reactNative"
246
- );
247
- }
248
-
249
242
  useEffect(() => {
250
243
  if (!props.apiKey) {
251
244
  console.error(
@@ -301,7 +294,7 @@ export default function RenderContent(props) {
301
294
 
302
295
  /**
303
296
  * Make sure that:
304
- * - the preview model name is the same as the one we're rendering, since there can be multiple models rendered * at the same time, e.g. header/page/footer. * - the API key is the same, since we don't want to preview content from other organizations.
297
+ * - the preview model name is the same as the one we're rendering, since there can be multiple models rendered * at the same time, e.g. header/page/footer. * - the API key is the same, since we don't want to preview content from other organizations.
305
298
  *
306
299
  * TO-DO: should we check that the preview item ID is the same as the initial one being rendered? Or would
307
300
  * this break scenarios where the item is not published yet?
@@ -369,12 +362,14 @@ export default function RenderContent(props) {
369
362
  builder-content-id={useContent?.id}
370
363
  builder-model={props.model}
371
364
  >
372
- {shouldRenderContentStyles() ? (
373
- <RenderContentStyles
374
- contentId={useContent?.id}
375
- cssCode={useContent?.data?.cssCode}
376
- customFonts={useContent?.data?.customFonts}
377
- />
365
+ {TARGET !== "reactNative" ? (
366
+ <>
367
+ <RenderContentStyles
368
+ contentId={useContent?.id}
369
+ cssCode={useContent?.data?.cssCode}
370
+ customFonts={useContent?.data?.customFonts}
371
+ />
372
+ </>
378
373
  ) : null}
379
374
 
380
375
  <RenderBlocks
@@ -387,3 +382,5 @@ export default function RenderContent(props) {
387
382
  </builderContext.Provider>
388
383
  );
389
384
  }
385
+
386
+ export default RenderContent;
@@ -9,7 +9,7 @@ import {
9
9
  } from "react-native";
10
10
  import { TARGET } from "../constants/target.js";
11
11
 
12
- export default function RenderInlinedStyles(props) {
12
+ function RenderInlinedStyles(props) {
13
13
  function injectedStyleScript() {
14
14
  return `<${tag()}>${props.styles}</${tag()}>`;
15
15
  }
@@ -34,3 +34,5 @@ export default function RenderInlinedStyles(props) {
34
34
  </>
35
35
  );
36
36
  }
37
+
38
+ export default RenderInlinedStyles;
@@ -1,6 +1,7 @@
1
+ import { TARGET } from "../constants/target.js";
1
2
  import { isIframe } from "./is-iframe.js";
2
3
  function isEditing() {
3
- return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
4
+ return isIframe() && (TARGET === "reactNative" || window.location.search.indexOf("builder.frameEditing=") !== -1);
4
5
  }
5
6
  export {
6
7
  isEditing
package/src/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./index-helpers/top-of-file.js";
2
- import "./scripts/init-editing.js";
3
2
  export * from "./index-helpers/blocks-exports.js";
4
3
  export * from "./functions/is-editing.js";
5
4
  export * from "./functions/is-previewing.js";