@builder.io/sdk-react-native 0.0.1-36 → 0.0.1-37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/blocks/button.lite.tsx +0 -1
- package/src/blocks/columns.lite.tsx +0 -1
- package/src/blocks/custom-code.lite.tsx +1 -1
- package/src/blocks/embed.lite.tsx +1 -1
- package/src/blocks/form.lite.tsx +1 -1
- package/src/blocks/fragment.lite.tsx +0 -1
- package/src/blocks/image.lite.tsx +0 -1
- package/src/blocks/img.lite.tsx +0 -1
- package/src/blocks/input.lite.tsx +0 -1
- package/src/blocks/raw-text.lite.tsx +0 -1
- package/src/blocks/section.lite.tsx +0 -1
- package/src/blocks/select.lite.tsx +0 -1
- package/src/blocks/submit-button.lite.tsx +0 -1
- package/src/blocks/text.lite.tsx +0 -1
- package/src/blocks/textarea.lite.tsx +0 -1
- package/src/blocks/video.lite.tsx +0 -1
- package/src/components/block-styles.lite.tsx +0 -1
- package/src/components/error-boundary.lite.tsx +0 -1
- package/src/components/render-block.js +5 -2
- package/src/components/render-block.lite.tsx +7 -3
- package/src/components/render-blocks.lite.tsx +0 -1
- package/src/functions/evaluate.js +1 -1
- package/src/functions/get-block-actions.js +3 -0
- package/src/package.json +0 -18
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-
|
|
4
|
+
"version": "0.0.1-37",
|
|
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"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function CustomCode(props) {
|
|
6
6
|
const [scriptsInserted, setScriptsInserted] = useState(() => []);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
export default function Embed(props) {
|
|
6
6
|
const [scriptsInserted, setScriptsInserted] = useState(() => []);
|
package/src/blocks/form.lite.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
-
import { useState,
|
|
3
|
+
import { useState, useRef } from 'react';
|
|
4
4
|
import RenderBlock from '../components/render-block.lite';
|
|
5
5
|
|
|
6
6
|
export default function FormComponent(props) {
|
package/src/blocks/img.lite.tsx
CHANGED
package/src/blocks/text.lite.tsx
CHANGED
|
@@ -78,6 +78,9 @@ function RenderBlock(props) {
|
|
|
78
78
|
context: builderContext.context,
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
function propertiesAndActions() {
|
|
82
|
+
return __spreadValues(__spreadValues({}, properties()), actions());
|
|
83
|
+
}
|
|
81
84
|
function actions() {
|
|
82
85
|
return getBlockActions({
|
|
83
86
|
block: useBlock(),
|
|
@@ -105,7 +108,7 @@ function RenderBlock(props) {
|
|
|
105
108
|
null,
|
|
106
109
|
/* @__PURE__ */ React.createElement(
|
|
107
110
|
TagNameRef,
|
|
108
|
-
__spreadProps(__spreadValues({},
|
|
111
|
+
__spreadProps(__spreadValues({}, propertiesAndActions()), {
|
|
109
112
|
style: css(),
|
|
110
113
|
}),
|
|
111
114
|
/* @__PURE__ */ React.createElement(BlockStyles, {
|
|
@@ -154,7 +157,7 @@ function RenderBlock(props) {
|
|
|
154
157
|
: _c.options
|
|
155
158
|
),
|
|
156
159
|
{
|
|
157
|
-
attributes:
|
|
160
|
+
attributes: propertiesAndActions(),
|
|
158
161
|
builderBlock: useBlock(),
|
|
159
162
|
style: css(),
|
|
160
163
|
children: useBlock().children,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View, StyleSheet, Image, Text } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { useContext } from 'react';
|
|
4
4
|
import { getBlockComponentOptions } from '../functions/get-block-component-options';
|
|
5
5
|
import { getBlockProperties } from '../functions/get-block-properties';
|
|
6
6
|
import { getBlockStyles } from '../functions/get-block-styles';
|
|
@@ -56,6 +56,10 @@ export default function RenderBlock(props) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function propertiesAndActions() {
|
|
60
|
+
return { ...properties(), ...actions() };
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
function actions() {
|
|
60
64
|
return getBlockActions({
|
|
61
65
|
block: useBlock(),
|
|
@@ -81,7 +85,7 @@ export default function RenderBlock(props) {
|
|
|
81
85
|
<>
|
|
82
86
|
{!componentInfo?.()?.noWrap ? (
|
|
83
87
|
<>
|
|
84
|
-
<TagNameRef {...
|
|
88
|
+
<TagNameRef {...propertiesAndActions()} style={css()}>
|
|
85
89
|
<BlockStyles block={useBlock()} />
|
|
86
90
|
|
|
87
91
|
{componentRef() ? (
|
|
@@ -114,7 +118,7 @@ export default function RenderBlock(props) {
|
|
|
114
118
|
) : (
|
|
115
119
|
<ComponentRefRef
|
|
116
120
|
{...componentInfo?.()?.options}
|
|
117
|
-
attributes={
|
|
121
|
+
attributes={propertiesAndActions()}
|
|
118
122
|
builderBlock={useBlock()}
|
|
119
123
|
style={css()}
|
|
120
124
|
children={useBlock().children}
|
|
@@ -23,7 +23,7 @@ function evaluate(options) {
|
|
|
23
23
|
useCode
|
|
24
24
|
)(builder, builder, options.state, options.context, options.event);
|
|
25
25
|
} catch (e) {
|
|
26
|
-
console.warn('Builder custom code error', e);
|
|
26
|
+
console.warn('Builder custom code error: ', e);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export { evaluate };
|
|
@@ -7,6 +7,9 @@ function getBlockActions(options) {
|
|
|
7
7
|
const obj = {};
|
|
8
8
|
if (options.block.actions) {
|
|
9
9
|
for (const key in options.block.actions) {
|
|
10
|
+
if (!options.block.actions.hasOwnProperty(key)) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
10
13
|
const value = options.block.actions[key];
|
|
11
14
|
obj['on' + capitalizeFirstLetter(key)] = (event) =>
|
|
12
15
|
evaluate({
|
package/src/package.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@builder.io/sdk-react-native",
|
|
3
|
-
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "0.0.1-1",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"react-native-render-html": "^5.1.1"
|
|
11
|
-
},
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"react-native": "^0.64.2"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"react-native": "^0.64.2"
|
|
17
|
-
}
|
|
18
|
-
}
|