@shopify/react-native-skia 2.2.12 → 2.2.13

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.
@@ -47,7 +47,7 @@
47
47
  * Creates a JSI export function declaration
48
48
  */
49
49
  #define JSI_EXPORT_FUNC(CLASS, FUNCTION) \
50
- {#FUNCTION, (jsi::Value(JsiHostObject::*)( \
50
+ {#FUNCTION, (jsi::Value (JsiHostObject::*)( \
51
51
  jsi::Runtime & runtime, const jsi::Value &thisValue, \
52
52
  const jsi::Value *arguments, size_t)) & \
53
53
  CLASS::FUNCTION}
@@ -65,7 +65,7 @@
65
65
  * Creates a JSI export getter declaration
66
66
  */
67
67
  #define JSI_EXPORT_PROP_GET(CLASS, FUNCTION) \
68
- {#FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) & \
68
+ {#FUNCTION, (jsi::Value (JsiHostObject::*)(jsi::Runtime & runtime)) & \
69
69
  CLASS::STR_CAT(STR_GET, FUNCTION)}
70
70
 
71
71
  /**
@@ -83,7 +83,7 @@
83
83
  */
84
84
  #define JSI_EXPORT_PROP_SET(CLASS, FUNCTION) \
85
85
  {#FUNCTION, \
86
- (void(JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
86
+ (void (JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \
87
87
  CLASS::STR_CAT(STR_SET, FUNCTION)}
88
88
 
89
89
  /**
@@ -105,10 +105,15 @@ public:
105
105
  if (name == "onSize" && isSharedValue(runtime, arguments[2])) {
106
106
  jsi::Object size(runtime);
107
107
  auto pd = _platformContext->getPixelDensity();
108
- size.setProperty(runtime, "width",
109
- info->view->getScaledWidth() / pd);
110
- size.setProperty(runtime, "height",
111
- info->view->getScaledHeight() / pd);
108
+ auto w = info->view != nullptr
109
+ ? std::max(info->view->getScaledWidth(), 0)
110
+ : 0;
111
+ auto h = info->view != nullptr
112
+ ? std::max(info->view->getScaledHeight(), 0)
113
+ : 0;
114
+
115
+ size.setProperty(runtime, "width", w / pd);
116
+ size.setProperty(runtime, "height", h / pd);
112
117
  arguments[2].asObject(runtime).setProperty(runtime, "value", size);
113
118
  } else {
114
119
  info->props.insert_or_assign(
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "setup-skia-web": "scripts/setup-canvaskit.js"
9
9
  },
10
10
  "title": "React Native Skia",
11
- "version": "2.2.12",
11
+ "version": "2.2.13",
12
12
  "description": "High-performance React Native Graphics using Skia",
13
13
  "main": "lib/module/index.js",
14
14
  "react-native": "src/index.ts",