@builder.io/sdk-react-native 0.0.1-37 → 0.0.1-40

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-37",
4
+ "version": "0.0.1-40",
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"
@@ -11,10 +11,10 @@
11
11
  "react-native-video": "^5.1.1"
12
12
  },
13
13
  "peerDependencies": {
14
- "react-native": "^0.64.2"
14
+ "react-native": "^0.64.3"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@types/react-native-video": "^5.0.9",
18
- "react-native": "^0.64.2"
18
+ "react-native": "^0.64.3"
19
19
  }
20
20
  }
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ function capitalizeFirstLetter(string) {
3
+ return string.charAt(0).toUpperCase() + string.slice(1);
4
+ }
5
+ const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
6
+ export { getEventHandlerName };
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { evaluate } from './evaluate';
3
- function capitalizeFirstLetter(string) {
4
- return string.charAt(0).toUpperCase() + string.slice(1);
5
- }
3
+ import { getEventHandlerName } from './event-handler-name';
6
4
  function getBlockActions(options) {
7
5
  const obj = {};
8
6
  if (options.block.actions) {
@@ -11,7 +9,7 @@ function getBlockActions(options) {
11
9
  continue;
12
10
  }
13
11
  const value = options.block.actions[key];
14
- obj['on' + capitalizeFirstLetter(key)] = (event) =>
12
+ obj[getEventHandlerName(key)] = (event) =>
15
13
  evaluate({
16
14
  code: value,
17
15
  context: options.context,
@@ -26,8 +26,10 @@ var __spreadValues = (a, b) => {
26
26
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
27
  import { evaluate } from './evaluate';
28
28
  import { set } from './set';
29
+ import { transformBlock } from './transform-block';
29
30
  function getProcessedBlock(options) {
30
- const { block, state, context } = options;
31
+ const { state, context } = options;
32
+ const block = transformBlock(options.block);
31
33
  if (!block.bindings) {
32
34
  return block;
33
35
  }
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) =>
9
+ key in obj
10
+ ? __defProp(obj, key, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value,
15
+ })
16
+ : (obj[key] = value);
17
+ var __spreadValues = (a, b) => {
18
+ for (var prop in b || (b = {}))
19
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
20
+ if (__getOwnPropSymbols)
21
+ for (var prop of __getOwnPropSymbols(b)) {
22
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
23
+ }
24
+ return a;
25
+ };
26
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
27
+ function transformBlock(block) {
28
+ if (block.id.startsWith('builder-pixel-')) {
29
+ return __spreadProps(__spreadValues({}, block), {
30
+ component: {
31
+ name: 'Image',
32
+ options: {
33
+ image: block.properties.src,
34
+ },
35
+ },
36
+ });
37
+ }
38
+ return block;
39
+ }
40
+ export { transformBlock };