@shopify/react-native-skia 0.1.224 → 0.1.225

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
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.224",
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": [