@builder.io/sdk-react-native 0.0.1-56 → 0.0.1-59

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/CHANGELOG.md +5 -1
  2. package/README.md +4 -0
  3. package/package.json +1 -1
  4. package/src/blocks/custom-code/custom-code.js +1 -1
  5. package/src/blocks/embed/embed.js +1 -1
  6. package/src/blocks/form/form.js +1 -1
  7. package/src/components/render-block/block-styles.js +16 -18
  8. package/src/constants/device-sizes.js +3 -21
  9. package/src/functions/camel-to-kebab-case.js +5 -0
  10. package/src/helpers/css.js +13 -0
  11. package/src/blocks/button/button.lite.tsx +0 -25
  12. package/src/blocks/columns/columns.lite.tsx +0 -70
  13. package/src/blocks/custom-code/custom-code.lite.tsx +0 -59
  14. package/src/blocks/embed/embed.lite.tsx +0 -61
  15. package/src/blocks/form/form.lite.tsx +0 -254
  16. package/src/blocks/fragment/fragment.lite.tsx +0 -10
  17. package/src/blocks/image/image.lite.tsx +0 -67
  18. package/src/blocks/img/img.lite.tsx +0 -18
  19. package/src/blocks/input/input.lite.tsx +0 -20
  20. package/src/blocks/raw-text/raw-text.lite.tsx +0 -6
  21. package/src/blocks/section/section.lite.tsx +0 -19
  22. package/src/blocks/select/select.lite.tsx +0 -23
  23. package/src/blocks/submit-button/submit-button.lite.tsx +0 -10
  24. package/src/blocks/symbol/symbol.lite.tsx +0 -60
  25. package/src/blocks/text/text.lite.tsx +0 -6
  26. package/src/blocks/textarea/textarea.lite.tsx +0 -14
  27. package/src/blocks/video/video.lite.tsx +0 -27
  28. package/src/components/error-boundary.js +0 -25
  29. package/src/components/error-boundary.lite.tsx +0 -6
  30. package/src/components/render-block/block-styles.lite.tsx +0 -57
  31. package/src/components/render-block/render-block.lite.tsx +0 -148
  32. package/src/components/render-block/render-component.lite.tsx +0 -26
  33. package/src/components/render-blocks.lite.tsx +0 -74
  34. package/src/components/render-content/components/render-styles.lite.tsx +0 -70
  35. package/src/components/render-content/render-content.lite.tsx +0 -283
  36. package/src/components/render-inlined-styles.lite.tsx +0 -31
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.1-56
2
+
3
+ 🐛 Fix: image block `srcSet` was incorrectly set as `srcset`
4
+
1
5
  ### 0.0.1-55
2
6
 
3
7
  🐛 Fix: custom components were not rendering correctly
@@ -10,7 +14,7 @@ See [builder-registered-components.ts](/packages/sdks/src/constants/builder-regi
10
14
 
11
15
  ### 0.0.1-51
12
16
 
13
- ⚠️ Deprecation notice: Registering components via `registerComponent(component, info)` is now deprecated.
17
+ ⚠️ Deprecation notice: Registering components via `registerComponent(component, info)` is now deprecated.
14
18
  To register your custom components in Builder, you must now provide a `customComponents` array to the `RenderContent` component containing `[{ component, info }]`.
15
19
  See [builder-registered-components.ts](/packages/sdks/src/constants/builder-registered-components.ts) for examples of how to do so, or see the example provided for this SDK.
16
20
 
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This is the React-Native SDK. It is currently in beta.
4
4
 
5
+ ## Mitosis
6
+
7
+ This SDK is generated by [Mitosis](https://github.com/BuilderIO/mitosis). To see the Mitosis source-code, go [here](../../).
8
+
5
9
  ## Feature Support
6
10
 
7
11
  To check the status of the SDK, look at [these tables](../../README.md#feature-implementation).
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.0.1-56",
4
+ "version": "0.0.1-59",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import { View } from "react-native";
3
3
  import { useState, useRef, useEffect } from "react";
4
4
  function CustomCode(props) {
5
+ const elem = useRef(null);
5
6
  const [scriptsInserted, setScriptsInserted] = useState(() => []);
6
7
  const [scriptsRun, setScriptsRun] = useState(() => []);
7
8
  function findAndRunScripts() {
@@ -36,7 +37,6 @@ function CustomCode(props) {
36
37
  }
37
38
  }
38
39
  }
39
- const elem = useRef();
40
40
  useEffect(() => {
41
41
  findAndRunScripts();
42
42
  }, []);
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import { View } from "react-native";
3
3
  import { useState, useRef, useEffect } from "react";
4
4
  function Embed(props) {
5
+ const elem = useRef(null);
5
6
  const [scriptsInserted, setScriptsInserted] = useState(() => []);
6
7
  const [scriptsRun, setScriptsRun] = useState(() => []);
7
8
  function findAndRunScripts() {
@@ -36,7 +37,6 @@ function Embed(props) {
36
37
  }
37
38
  }
38
39
  }
39
- const elem = useRef();
40
40
  useEffect(() => {
41
41
  findAndRunScripts();
42
42
  }, []);
@@ -44,6 +44,7 @@ import RenderBlock from "../../components/render-block/render-block.js";
44
44
  import { isEditing } from "../../functions/is-editing.js";
45
45
  function FormComponent(props) {
46
46
  var _a, _b;
47
+ const formRef = useRef(null);
47
48
  const [formState, setFormState] = useState(() => "unsubmitted");
48
49
  const [responseData, setResponseData] = useState(() => null);
49
50
  const [formErrorMessage, setFormErrorMessage] = useState(() => "");
@@ -190,7 +191,6 @@ function FormComponent(props) {
190
191
  });
191
192
  }
192
193
  }
193
- const formRef = useRef();
194
194
  return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
195
195
  validate: props.validate,
196
196
  ref: formRef,
@@ -4,6 +4,8 @@ import { TARGET } from "../../constants/target.js";
4
4
  import BuilderContext from "../../context/builder.context";
5
5
  import { getProcessedBlock } from "../../functions/get-processed-block.js";
6
6
  import RenderInlinedStyles from "../render-inlined-styles.js";
7
+ import { convertStyleMaptoCSS } from "../../helpers/css.js";
8
+ import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
7
9
  function BlockStyles(props) {
8
10
  function useBlock() {
9
11
  return getProcessedBlock({
@@ -12,27 +14,23 @@ function BlockStyles(props) {
12
14
  context: builderContext.context
13
15
  });
14
16
  }
15
- function camelToKebabCase(string) {
16
- return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
17
- }
18
17
  function css() {
19
- var _a;
20
- const styleObject = (_a = useBlock().responsiveStyles) == null ? void 0 : _a.large;
21
- if (!styleObject) {
22
- return "";
23
- }
24
- let str = `.${useBlock().id} {`;
25
- for (const key in styleObject) {
26
- const value = styleObject[key];
27
- if (typeof value === "string") {
28
- str += `${camelToKebabCase(key)}: ${value};`;
29
- }
30
- }
31
- str += "}";
32
- return str;
18
+ const styles = useBlock().responsiveStyles;
19
+ const largeStyles = styles == null ? void 0 : styles.large;
20
+ const mediumStyles = styles == null ? void 0 : styles.medium;
21
+ const smallStyles = styles == null ? void 0 : styles.small;
22
+ return `
23
+ ${largeStyles ? `.${useBlock().id} {${convertStyleMaptoCSS(largeStyles)}}` : ""}
24
+ ${mediumStyles ? `${getMaxWidthQueryForSize("medium")} {
25
+ .${useBlock().id} {${convertStyleMaptoCSS(mediumStyles)}}
26
+ }` : ""}
27
+ ${smallStyles ? `${getMaxWidthQueryForSize("small")} {
28
+ .${useBlock().id} {${convertStyleMaptoCSS(smallStyles)}}
29
+ }` : ""}
30
+ }`;
33
31
  }
34
32
  const builderContext = useContext(BuilderContext);
35
- return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET === "vue" || TARGET === "svelte" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
33
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
36
34
  styles: css()
37
35
  })) : null);
38
36
  }
@@ -1,11 +1,5 @@
1
1
  import * as React from 'react';
2
- const sizeNames = ["xsmall", "small", "medium", "large"];
3
- const sizes = {
4
- xsmall: {
5
- min: 0,
6
- default: 0,
7
- max: 0
8
- },
2
+ const SIZES = {
9
3
  small: {
10
4
  min: 320,
11
5
  default: 321,
@@ -20,21 +14,9 @@ const sizes = {
20
14
  min: 990,
21
15
  default: 991,
22
16
  max: 1200
23
- },
24
- getWidthForSize(size) {
25
- return this[size].default;
26
- },
27
- getSizeForWidth(width) {
28
- for (const size of sizeNames) {
29
- const value = this[size];
30
- if (width <= value.max) {
31
- return size;
32
- }
33
- }
34
- return "large";
35
17
  }
36
18
  };
19
+ const getMaxWidthQueryForSize = (size) => `@media (max-width: ${SIZES[size].max}px)`;
37
20
  export {
38
- sizeNames,
39
- sizes
21
+ getMaxWidthQueryForSize
40
22
  };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
3
+ export {
4
+ camelToKebabCase
5
+ };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { camelToKebabCase } from "../functions/camel-to-kebab-case";
3
+ const convertStyleMaptoCSS = (style) => {
4
+ const cssProps = Object.entries(style).map(([key, value]) => {
5
+ if (typeof value === "string") {
6
+ return `${camelToKebabCase(key)}: ${value};`;
7
+ }
8
+ });
9
+ return cssProps.join("\n");
10
+ };
11
+ export {
12
+ convertStyleMaptoCSS
13
+ };
@@ -1,25 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
-
4
- export default function Button(props) {
5
- return (
6
- <>
7
- {props.link ? (
8
- <>
9
- <View
10
- {...props.attributes}
11
- role="button"
12
- href={props.link}
13
- target={props.openLinkInNewTab ? "_blank" : undefined}
14
- >
15
- <Text>{props.text}</Text>
16
- </View>
17
- </>
18
- ) : (
19
- <View {...props.attributes}>
20
- <Text>{props.text}</Text>
21
- </View>
22
- )}
23
- </>
24
- );
25
- }
@@ -1,70 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import RenderBlocks from "../../components/render-blocks.lite";
4
-
5
- export default function Columns(props) {
6
- function getGutterSize() {
7
- return typeof props.space === "number" ? props.space || 0 : 20;
8
- }
9
-
10
- function getColumns() {
11
- return props.columns || [];
12
- }
13
-
14
- function getWidth(index) {
15
- const columns = getColumns();
16
- return columns[index]?.width || 100 / columns.length;
17
- }
18
-
19
- function getColumnCssWidth(index) {
20
- const columns = getColumns();
21
- const gutterSize = getGutterSize();
22
- const subtractWidth = (gutterSize * (columns.length - 1)) / columns.length;
23
- return `calc(${getWidth(index)}% - ${subtractWidth}px)`;
24
- }
25
-
26
- function maybeApplyForTablet(prop) {
27
- const _stackColumnsAt = props.stackColumnsAt || "tablet";
28
-
29
- return _stackColumnsAt === "tablet" ? prop : "inherit";
30
- }
31
-
32
- function columnsCssVars() {
33
- const flexDir =
34
- props.stackColumnsAt === "never"
35
- ? "inherit"
36
- : props.reverseColumnsWhenStacked
37
- ? "column-reverse"
38
- : "column";
39
- return {
40
- "--flex-dir": flexDir,
41
- "--flex-dir-tablet": maybeApplyForTablet(flexDir),
42
- };
43
- }
44
-
45
- function columnCssVars() {
46
- const width = "100%";
47
- const marginLeft = "0";
48
- return {
49
- "--column-width": width,
50
- "--column-margin-left": marginLeft,
51
- "--column-width-tablet": maybeApplyForTablet(width),
52
- "--column-margin-left-tablet": maybeApplyForTablet(marginLeft),
53
- };
54
- }
55
-
56
- return (
57
- <View style={styles.view1}>
58
- {props.columns?.map((column, index) => (
59
- <View style={styles.view2} key={index}>
60
- <RenderBlocks blocks={column.blocks} />
61
- </View>
62
- ))}
63
- </View>
64
- );
65
- }
66
-
67
- const styles = StyleSheet.create({
68
- view1: { display: "flex", alignItems: "stretch" },
69
- view2: { flexGrow: 1 },
70
- });
@@ -1,59 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useState, useRef, useEffect } from "react";
4
-
5
- export default function CustomCode(props) {
6
- const [scriptsInserted, setScriptsInserted] = useState(() => []);
7
-
8
- const [scriptsRun, setScriptsRun] = useState(() => []);
9
-
10
- function findAndRunScripts() {
11
- // TODO: Move this function to standalone one in '@builder.io/utils'
12
- if (elem.current && typeof window !== "undefined") {
13
- /** @type {HTMLScriptElement[]} */
14
- const scripts = elem.current.getElementsByTagName("script");
15
-
16
- for (let i = 0; i < scripts.length; i++) {
17
- const script = scripts[i];
18
-
19
- if (script.src) {
20
- if (scriptsInserted.includes(script.src)) {
21
- continue;
22
- }
23
-
24
- scriptsInserted.push(script.src);
25
- const newScript = document.createElement("script");
26
- newScript.async = true;
27
- newScript.src = script.src;
28
- document.head.appendChild(newScript);
29
- } else if (
30
- !script.type ||
31
- [
32
- "text/javascript",
33
- "application/javascript",
34
- "application/ecmascript",
35
- ].includes(script.type)
36
- ) {
37
- if (scriptsRun.includes(script.innerText)) {
38
- continue;
39
- }
40
-
41
- try {
42
- scriptsRun.push(script.innerText);
43
- new Function(script.innerText)();
44
- } catch (error) {
45
- console.warn("`CustomCode`: Error running script:", error);
46
- }
47
- }
48
- }
49
- }
50
- }
51
-
52
- const elem = useRef();
53
-
54
- useEffect(() => {
55
- findAndRunScripts();
56
- }, []);
57
-
58
- return <View ref={elem} dangerouslySetInnerHTML={{ __html: props.code }} />;
59
- }
@@ -1,61 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useState, useRef, useEffect } from "react";
4
-
5
- export default function Embed(props) {
6
- const [scriptsInserted, setScriptsInserted] = useState(() => []);
7
-
8
- const [scriptsRun, setScriptsRun] = useState(() => []);
9
-
10
- function findAndRunScripts() {
11
- // TODO: Move this function to standalone one in '@builder.io/utils'
12
- if (elem.current && typeof window !== "undefined") {
13
- /** @type {HTMLScriptElement[]} */
14
- const scripts = elem.current.getElementsByTagName("script");
15
-
16
- for (let i = 0; i < scripts.length; i++) {
17
- const script = scripts[i];
18
-
19
- if (script.src) {
20
- if (scriptsInserted.includes(script.src)) {
21
- continue;
22
- }
23
-
24
- scriptsInserted.push(script.src);
25
- const newScript = document.createElement("script");
26
- newScript.async = true;
27
- newScript.src = script.src;
28
- document.head.appendChild(newScript);
29
- } else if (
30
- !script.type ||
31
- [
32
- "text/javascript",
33
- "application/javascript",
34
- "application/ecmascript",
35
- ].includes(script.type)
36
- ) {
37
- if (scriptsRun.includes(script.innerText)) {
38
- continue;
39
- }
40
-
41
- try {
42
- scriptsRun.push(script.innerText);
43
- new Function(script.innerText)();
44
- } catch (error) {
45
- console.warn("`Embed`: Error running script:", error);
46
- }
47
- }
48
- }
49
- }
50
- }
51
-
52
- const elem = useRef();
53
-
54
- useEffect(() => {
55
- findAndRunScripts();
56
- }, []);
57
-
58
- return (
59
- <View ref={elem} dangerouslySetInnerHTML={{ __html: props.content }} />
60
- );
61
- }
@@ -1,254 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useState, useRef } from "react";
4
- import RenderBlock from "../../components/render-block/render-block.lite";
5
- import { isEditing } from "../../functions/is-editing.js";
6
-
7
- export default function FormComponent(props) {
8
- const [formState, setFormState] = useState(() => "unsubmitted");
9
-
10
- const [responseData, setResponseData] = useState(() => null);
11
-
12
- const [formErrorMessage, setFormErrorMessage] = useState(() => "");
13
-
14
- function submissionState() {
15
- return (isEditing() && props.previewState) || formState;
16
- }
17
-
18
- function onSubmit(event) {
19
- const sendWithJs = props.sendWithJs || props.sendSubmissionsTo === "email";
20
-
21
- if (props.sendSubmissionsTo === "zapier") {
22
- event.preventDefault();
23
- } else if (sendWithJs) {
24
- if (!(props.action || props.sendSubmissionsTo === "email")) {
25
- event.preventDefault();
26
- return;
27
- }
28
-
29
- event.preventDefault();
30
- const el = event.currentTarget;
31
- const headers = props.customHeaders || {};
32
- let body;
33
- const formData = new FormData(el); // TODO: maybe support null
34
-
35
- const formPairs = Array.from(
36
- event.currentTarget.querySelectorAll("input,select,textarea")
37
- )
38
- .filter((el) => !!el.name)
39
- .map((el) => {
40
- let value;
41
- const key = el.name;
42
-
43
- if (el instanceof HTMLInputElement) {
44
- if (el.type === "radio") {
45
- if (el.checked) {
46
- value = el.name;
47
- return {
48
- key,
49
- value,
50
- };
51
- }
52
- } else if (el.type === "checkbox") {
53
- value = el.checked;
54
- } else if (el.type === "number" || el.type === "range") {
55
- const num = el.valueAsNumber;
56
-
57
- if (!isNaN(num)) {
58
- value = num;
59
- }
60
- } else if (el.type === "file") {
61
- // TODO: one vs multiple files
62
- value = el.files;
63
- } else {
64
- value = el.value;
65
- }
66
- } else {
67
- value = el.value;
68
- }
69
-
70
- return {
71
- key,
72
- value,
73
- };
74
- });
75
- let contentType = props.contentType;
76
-
77
- if (props.sendSubmissionsTo === "email") {
78
- contentType = "multipart/form-data";
79
- }
80
-
81
- Array.from(formPairs).forEach(({ value }) => {
82
- if (
83
- value instanceof File ||
84
- (Array.isArray(value) && value[0] instanceof File) ||
85
- value instanceof FileList
86
- ) {
87
- contentType = "multipart/form-data";
88
- }
89
- }); // TODO: send as urlEncoded or multipart by default
90
- // because of ease of use and reliability in browser API
91
- // for encoding the form?
92
-
93
- if (contentType !== "application/json") {
94
- body = formData;
95
- } else {
96
- // Json
97
- const json = {};
98
- Array.from(formPairs).forEach(({ value, key }) => {
99
- set(json, key, value);
100
- });
101
- body = JSON.stringify(json);
102
- }
103
-
104
- if (contentType && contentType !== "multipart/form-data") {
105
- if (
106
- /* Zapier doesn't allow content-type header to be sent from browsers */ !(
107
- sendWithJs && props.action?.includes("zapier.com")
108
- )
109
- ) {
110
- headers["content-type"] = contentType;
111
- }
112
- }
113
- const presubmitEvent = new CustomEvent("presubmit", { detail: { body } });
114
- if (formRef.current) {
115
- formRef.current.dispatchEvent(presubmitEvent);
116
- if (presubmitEvent.defaultPrevented) {
117
- return;
118
- }
119
- }
120
- setFormState("sending");
121
- const formUrl = `${
122
- builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"
123
- }/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(
124
- props.sendSubmissionsToEmail || ""
125
- )}&name=${encodeURIComponent(props.name || "")}`;
126
- fetch(
127
- props.sendSubmissionsTo === "email"
128
- ? formUrl
129
- : props.action /* TODO: throw error if no action URL */,
130
- { body, headers, method: props.method || "post" }
131
- ).then(
132
- async (res) => {
133
- let body;
134
- const contentType = res.headers.get("content-type");
135
- if (contentType && contentType.indexOf("application/json") !== -1) {
136
- body = await res.json();
137
- } else {
138
- body = await res.text();
139
- }
140
- if (!res.ok && props.errorMessagePath) {
141
- /* TODO: allow supplying an error formatter function */ let message =
142
- get(body, props.errorMessagePath);
143
- if (message) {
144
- if (typeof message !== "string") {
145
- /* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
146
- JSON.stringify(message);
147
- }
148
- setFormErrorMessage(message);
149
- }
150
- }
151
- setResponseData(body);
152
- setFormState(res.ok ? "success" : "error");
153
- if (res.ok) {
154
- const submitSuccessEvent = new CustomEvent("submit:success", {
155
- detail: { res, body },
156
- });
157
- if (formRef.current) {
158
- formRef.current.dispatchEvent(submitSuccessEvent);
159
- if (submitSuccessEvent.defaultPrevented) {
160
- return;
161
- }
162
- /* TODO: option to turn this on/off? */ if (
163
- props.resetFormOnSubmit !== false
164
- ) {
165
- formRef.current.reset();
166
- }
167
- }
168
- /* TODO: client side route event first that can be preventDefaulted */ if (
169
- props.successUrl
170
- ) {
171
- if (formRef.current) {
172
- const event = new CustomEvent("route", {
173
- detail: { url: props.successUrl },
174
- });
175
- formRef.current.dispatchEvent(event);
176
- if (!event.defaultPrevented) {
177
- location.href = props.successUrl;
178
- }
179
- } else {
180
- location.href = props.successUrl;
181
- }
182
- }
183
- }
184
- },
185
- (err) => {
186
- const submitErrorEvent = new CustomEvent("submit:error", {
187
- detail: { error: err },
188
- });
189
- if (formRef.current) {
190
- formRef.current.dispatchEvent(submitErrorEvent);
191
- if (submitErrorEvent.defaultPrevented) {
192
- return;
193
- }
194
- }
195
- setResponseData(err);
196
- setFormState("error");
197
- }
198
- );
199
- }
200
- }
201
- const formRef = useRef();
202
- return (
203
- <View
204
- {...props.attributes}
205
- validate={props.validate}
206
- ref={formRef}
207
- action={!props.sendWithJs && props.action}
208
- method={props.method}
209
- name={props.name}
210
- onSubmit={(event) => onSubmit(event)}
211
- >
212
- {" "}
213
- {props.builderBlock && props.builderBlock.children ? (
214
- <>
215
- {props.builderBlock?.children?.map((block) => (
216
- <RenderBlock block={block} />
217
- ))}
218
- </>
219
- ) : null}{" "}
220
- {submissionState() === "error" ? (
221
- <>
222
- <BuilderBlocks dataPath="errorMessage" blocks={props.errorMessage} />
223
- </>
224
- ) : null}{" "}
225
- {submissionState() === "sending" ? (
226
- <>
227
- <BuilderBlocks
228
- dataPath="sendingMessage"
229
- blocks={props.sendingMessage}
230
- />
231
- </>
232
- ) : null}{" "}
233
- {submissionState() === "error" && responseData ? (
234
- <>
235
- <View style={styles.view1}>
236
- {" "}
237
- <Text>{JSON.stringify(responseData, null, 2)}</Text>{" "}
238
- </View>
239
- </>
240
- ) : null}{" "}
241
- {submissionState() === "success" ? (
242
- <>
243
- <BuilderBlocks
244
- dataPath="successMessage"
245
- blocks={props.successMessage}
246
- />
247
- </>
248
- ) : null}{" "}
249
- </View>
250
- );
251
- }
252
- const styles = StyleSheet.create({
253
- view1: { padding: 10, color: "red", textAlign: "center" },
254
- });
@@ -1,10 +0,0 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
-
4
- export default function FragmentComponent(props) {
5
- return (
6
- <View>
7
- <Text>{props.children}</Text>
8
- </View>
9
- );
10
- }