@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 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-36",
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,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function Button(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useState, useContext } from 'react';
4
3
  import RenderBlocks from '../components/render-blocks.lite';
5
4
 
6
5
  export default function Columns(props) {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useState, useContext, useRef, useEffect } from 'react';
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, useContext, useRef, useEffect } from 'react';
3
+ import { useState, useRef, useEffect } from 'react';
4
4
 
5
5
  export default function Embed(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, useContext, useRef } from 'react';
3
+ import { useState, useRef } from 'react';
4
4
  import RenderBlock from '../components/render-block.lite';
5
5
 
6
6
  export default function FormComponent(props) {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function FragmentComponent(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function Image(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
  import { isEditing } from '../functions/is-editing';
5
4
 
6
5
  export default function ImgComponent(props) {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
  import { isEditing } from '../functions/is-editing';
5
4
 
6
5
  export default function FormInputComponent(props) {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function RawText(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function SectionComponent(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
  import { isEditing } from '../functions/is-editing';
5
4
 
6
5
  export default function SelectComponent(props) {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function SubmitButton(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function Text(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function Textarea(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function Video(props) {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function BlockStyles(props) {
6
5
  return <></>;
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useContext } from 'react';
4
3
 
5
4
  export default function ErrorBoundary(props) {
6
5
  return <></>;
@@ -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({}, properties()), {
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: properties(),
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 { useState, useContext } from 'react';
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 {...properties()} style={css()}>
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={properties()}
121
+ attributes={propertiesAndActions()}
118
122
  builderBlock={useBlock()}
119
123
  style={css()}
120
124
  children={useBlock().children}
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { useState, useContext } from 'react';
4
3
  import { isEditing } from '../functions/is-editing';
5
4
  import RenderBlock from './render-block.lite';
6
5
 
@@ -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
- }