@builder.io/sdk-react-native 0.0.2 → 0.0.3

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.2",
4
+ "version": "0.0.3",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "release:patch": "npm version patch --no-git-tag-version && npm publish --access public",
@@ -15,17 +15,28 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  import { getMaxWidthQueryForSize } from "../constants/device-sizes.js";
18
+ import { TARGET } from "../constants/target.js";
18
19
  import { convertStyleObject } from "./convert-style-object.js";
19
20
  import { sanitizeBlockStyles } from "./sanitize-styles.js";
20
- function getBlockStyles(block) {
21
- const responsiveStyles = block.responsiveStyles;
22
- const styles = __spreadValues(__spreadValues({}, convertStyleObject(responsiveStyles == null ? void 0 : responsiveStyles.large)), block.styles);
23
- if (responsiveStyles == null ? void 0 : responsiveStyles.medium) {
24
- styles[getMaxWidthQueryForSize("medium")] = convertStyleObject(responsiveStyles.medium);
21
+ const getStyleForTarget = (styles) => {
22
+ switch (TARGET) {
23
+ case "reactNative": {
24
+ return __spreadValues(__spreadValues(__spreadValues({}, styles.large ? convertStyleObject(styles.large) : {}), styles.medium ? convertStyleObject(styles.medium) : {}), styles.small ? convertStyleObject(styles.small) : {});
25
+ }
26
+ default:
27
+ return __spreadValues(__spreadValues(__spreadValues({}, styles.large ? convertStyleObject(styles.large) : {}), styles.medium ? {
28
+ [getMaxWidthQueryForSize("medium")]: convertStyleObject(styles.medium)
29
+ } : {}), styles.small ? {
30
+ [getMaxWidthQueryForSize("small")]: convertStyleObject(styles.small)
31
+ } : {});
25
32
  }
26
- if (responsiveStyles == null ? void 0 : responsiveStyles.small) {
27
- styles[getMaxWidthQueryForSize("small")] = convertStyleObject(responsiveStyles.small);
33
+ };
34
+ function getBlockStyles(block) {
35
+ if (!block.responsiveStyles) {
36
+ return {};
28
37
  }
38
+ const styles = getStyleForTarget(block.responsiveStyles);
39
+ console.log("rn styles", styles);
29
40
  sanitizeBlockStyles(styles);
30
41
  return styles;
31
42
  }