@shopify/react-native-skia 0.1.125 → 0.1.126

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ using namespace facebook;
9
9
 
10
10
  enum JsiWrapperValueType
11
11
  {
12
+ NonInitialized,
12
13
  Undefined,
13
14
  Null,
14
15
  Bool,
@@ -25,7 +26,7 @@ class JsiSimpleValueWrapper
25
26
  {
26
27
  public:
27
28
  JsiSimpleValueWrapper(jsi::Runtime& runtime) :
28
- _type(JsiWrapperValueType::Undefined),
29
+ _type(JsiWrapperValueType::NonInitialized),
29
30
  _propNameId(jsi::PropNameID::forUtf8(runtime, "value"))
30
31
  {}
31
32
 
@@ -33,6 +34,8 @@ public:
33
34
  {
34
35
  switch (_type)
35
36
  {
37
+ case JsiWrapperValueType::NonInitialized:
38
+ return nullptr;
36
39
  case JsiWrapperValueType::Undefined:
37
40
  return jsi::Value::undefined();
38
41
  case JsiWrapperValueType::Null:
@@ -72,16 +75,23 @@ public:
72
75
  }
73
76
 
74
77
  bool equals(jsi::Runtime& runtime, const jsi::Value &value) {
75
- if(value.isNumber()) {
78
+ if (_type == JsiWrapperValueType::NonInitialized) {
79
+ return false;
80
+ }
81
+ if(value.isNumber() && _type == JsiWrapperValueType::Number) {
76
82
  return _numberValue == value.asNumber();
77
- } else if(value.isBool()) {
83
+ } else if(value.isBool() && _type == JsiWrapperValueType::Bool) {
78
84
  return _boolValue == value.getBool();
79
85
  } else if(value.isUndefined()) {
80
86
  return _type == JsiWrapperValueType::Undefined;
81
87
  } else if(value.isNull()) {
82
88
  return _type == JsiWrapperValueType::Null;
83
89
  } else if(value.isString()) {
84
- return jsi::String::strictEquals(runtime, value.asString(runtime), getCurrent(runtime).asString(runtime));
90
+ auto current = getCurrent(runtime);
91
+ if (current.isString()) {
92
+ return jsi::String::strictEquals(runtime, value.asString(runtime), current.asString(runtime));
93
+ }
94
+ return false;
85
95
  }
86
96
  return false;
87
97
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "React Native Skia",
7
- "version": "0.1.125",
7
+ "version": "0.1.126",
8
8
  "description": "High-performance React Native Graphics using Skia",
9
9
  "main": "lib/module/index.js",
10
10
  "files": [