@shopify/react-native-skia 1.5.9 → 1.5.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,8 +41,7 @@ public:
41
41
  std::shared_ptr<react::CallInvoker> callInvoker,
42
42
  float pixelDensity)
43
43
  : _pixelDensity(pixelDensity), _jsRuntime(runtime),
44
- _callInvoker(callInvoker) {
45
- }
44
+ _callInvoker(callInvoker) {}
46
45
 
47
46
  virtual ~RNSkPlatformContext() = default;
48
47
 
@@ -173,10 +173,17 @@ public:
173
173
  void requestRedraw() {
174
174
  if (!_redrawRequested) {
175
175
  _redrawRequested = true;
176
- _platformContext->runOnMainThread([this]() {
177
- if (_renderer) {
178
- _renderer->renderImmediate(_canvasProvider);
179
- _redrawRequested = false;
176
+ // Capture a weak pointer to this
177
+ auto weakThis = std::weak_ptr<RNSkView>(shared_from_this());
178
+
179
+ _platformContext->runOnMainThread([weakThis]() {
180
+ // Try to lock the weak pointer
181
+ if (auto strongThis = weakThis.lock()) {
182
+ // Only proceed if the object still exists
183
+ if (strongThis->_renderer) {
184
+ strongThis->_renderer->renderImmediate(strongThis->_canvasProvider);
185
+ strongThis->_redrawRequested = false;
186
+ }
180
187
  }
181
188
  });
182
189
  }
@@ -1,6 +1,5 @@
1
1
  import type { ViewProps } from "react-native";
2
2
  export interface NativeProps extends ViewProps {
3
- mode: string;
4
3
  debug?: boolean;
5
4
  }
6
5
  declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
@@ -1 +1 @@
1
- {"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sources":["SkiaDomViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n mode: string;\n debug?: boolean;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaDomView\");\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQ7F;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GACe,IAAAG,+BAAsB,EAAc,aAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sources":["SkiaDomViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaDomView\");\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAO7F;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GACe,IAAAG,+BAAsB,EAAc,aAAa,CAAC","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import type { ViewProps } from "react-native";
2
2
  export interface NativeProps extends ViewProps {
3
- mode: string;
4
3
  debug?: boolean;
5
4
  }
6
5
  declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
@@ -1 +1 @@
1
- {"version":3,"names":["codegenNativeComponent"],"sources":["SkiaDomViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n mode: string;\n debug?: boolean;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaDomView\");\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAQ5F;AACA,eAAeA,sBAAsB,CAAc,aAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["codegenNativeComponent"],"sources":["SkiaDomViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\nimport type { ViewProps } from \"react-native\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaDomView\");\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAO5F;AACA,eAAeA,sBAAsB,CAAc,aAAa,CAAC","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import type { ViewProps } from "react-native";
2
2
  export interface NativeProps extends ViewProps {
3
- mode: string;
4
3
  debug?: boolean;
5
4
  }
6
5
  declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
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": "1.5.9",
10
+ "version": "1.5.10",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -2,7 +2,6 @@ import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNati
2
2
  import type { ViewProps } from "react-native";
3
3
 
4
4
  export interface NativeProps extends ViewProps {
5
- mode: string;
6
5
  debug?: boolean;
7
6
  }
8
7