@shopify/react-native-skia 0.1.223 → 0.1.225

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.
@@ -44,9 +44,9 @@
44
44
  #include "JsiSkShaderFactory.h"
45
45
  #include "JsiSkSurfaceFactory.h"
46
46
  #include "JsiSkTextBlobFactory.h"
47
- #include "JsiSkTypeFaceFontProviderFactory.h"
48
47
  #include "JsiSkTypeface.h"
49
48
  #include "JsiSkTypefaceFactory.h"
49
+ #include "JsiSkTypefaceFontProviderFactory.h"
50
50
  #include "JsiSkVertices.h"
51
51
 
52
52
  namespace RNSkia {
@@ -24,6 +24,7 @@ namespace RNSkia {
24
24
  namespace jsi = facebook::jsi;
25
25
 
26
26
  namespace para = skia::textlayout;
27
+
27
28
  /**
28
29
  Implementation of the ParagraphStyle object in JSI
29
30
  */
@@ -60,7 +61,7 @@ public:
60
61
 
61
62
  if (object.hasProperty(runtime, "disableHinting")) {
62
63
  auto propValue = object.getProperty(runtime, "disableHinting");
63
- if (propValue.asBool()) {
64
+ if (asBool(runtime, propValue)) {
64
65
  retVal.turnHintingOff();
65
66
  }
66
67
  }
@@ -83,7 +84,7 @@ public:
83
84
  }
84
85
  if (object.hasProperty(runtime, "replaceTabCharacters")) {
85
86
  auto propValue = object.getProperty(runtime, "replaceTabCharacters");
86
- retVal.setReplaceTabCharacters(propValue.asBool());
87
+ retVal.setReplaceTabCharacters(asBool(runtime, propValue));
87
88
  }
88
89
  if (object.hasProperty(runtime, "textAlign")) {
89
90
  auto propValue = object.getProperty(runtime, "textAlign");
@@ -20,6 +20,13 @@ namespace jsi = facebook::jsi;
20
20
 
21
21
  namespace para = skia::textlayout;
22
22
 
23
+ bool asBool(jsi::Runtime &runtime, const jsi::Value &value) {
24
+ if (!value.isBool()) {
25
+ throw jsi::JSError(runtime, "Expected boolean value");
26
+ }
27
+ return value.getBool();
28
+ }
29
+
23
30
  /**
24
31
  Implementation of the TextStyle object in JSI for the paragraph builder
25
32
  */
@@ -47,7 +54,7 @@ public:
47
54
 
48
55
  if (object.hasProperty(runtime, "strutEnabled")) {
49
56
  auto propValue = object.getProperty(runtime, "strutEnabled");
50
- retVal.setStrutEnabled(propValue.asBool());
57
+ retVal.setStrutEnabled(asBool(runtime, propValue));
51
58
  }
52
59
  if (object.hasProperty(runtime, "fontFamilies")) {
53
60
  auto propValue = object.getProperty(runtime, "fontFamilies")
@@ -78,7 +85,7 @@ public:
78
85
  }
79
86
  if (object.hasProperty(runtime, "halfLeading")) {
80
87
  auto propValue = object.getProperty(runtime, "halfLeading");
81
- retVal.setHalfLeading(propValue.asBool());
88
+ retVal.setHalfLeading(asBool(runtime, propValue));
82
89
  }
83
90
  if (object.hasProperty(runtime, "leading")) {
84
91
  auto propValue = object.getProperty(runtime, "leading");
@@ -86,7 +93,7 @@ public:
86
93
  }
87
94
  if (object.hasProperty(runtime, "forceStrutHeight")) {
88
95
  auto propValue = object.getProperty(runtime, "forceStrutHeight");
89
- retVal.setForceStrutHeight(propValue.asBool());
96
+ retVal.setForceStrutHeight(asBool(runtime, propValue));
90
97
  }
91
98
 
92
99
  return retVal;
@@ -7,7 +7,7 @@
7
7
 
8
8
  #include "JsiSkData.h"
9
9
  #include "JsiSkHostObjects.h"
10
- #include "JsiSkTypeFaceFontProvider.h"
10
+ #include "JsiSkTypefaceFontProvider.h"
11
11
 
12
12
  namespace RNSkia {
13
13
 
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.223",
10
+ "version": "0.1.225",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [