@shopify/react-native-skia 0.1.175 → 0.1.178
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +2 -0
- package/android/build.gradle +2 -1
- package/cpp/jsi/JsiHostObject.cpp +13 -7
- package/cpp/jsi/JsiHostObject.h +3 -1
- package/cpp/jsi/RuntimeAwareCache.cpp +9 -0
- package/cpp/jsi/RuntimeAwareCache.h +101 -0
- package/cpp/jsi/RuntimeLifecycleMonitor.cpp +57 -0
- package/cpp/jsi/RuntimeLifecycleMonitor.h +32 -0
- package/cpp/rnskia/RNSkJsView.cpp +1 -1
- package/cpp/rnskia/RNSkManager.cpp +4 -0
- package/cpp/rnskia/dom/base/JsiDomNode.h +22 -2
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +12 -8
- package/lib/commonjs/external/reanimated/index.d.ts +1 -0
- package/lib/commonjs/external/reanimated/index.js +13 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +8 -0
- package/lib/commonjs/external/reanimated/moduleWrapper.js +72 -0
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -0
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +5 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +85 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -0
- package/lib/commonjs/external/reanimated/useSharedValueEffect.d.ts +2 -5
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js +10 -25
- package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +3 -0
- package/lib/commonjs/headless/index.js +57 -0
- package/lib/commonjs/headless/index.js.map +1 -0
- package/lib/commonjs/mock/index.d.ts +1 -2
- package/lib/commonjs/mock/index.js +0 -4
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +7 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.d.ts +2 -1
- package/lib/commonjs/renderer/Container.js +2 -0
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +6 -4
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +1 -1
- package/lib/commonjs/renderer/Reconciler.js +2 -1
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +4 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +8 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +1 -0
- package/lib/module/external/reanimated/index.js +1 -0
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +8 -0
- package/lib/module/external/reanimated/moduleWrapper.js +51 -0
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -0
- package/lib/module/external/reanimated/renderHelpers.d.ts +5 -0
- package/lib/module/external/reanimated/renderHelpers.js +76 -0
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -0
- package/lib/module/external/reanimated/useSharedValueEffect.d.ts +2 -5
- package/lib/module/external/reanimated/useSharedValueEffect.js +7 -22
- package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
- package/lib/module/headless/index.d.ts +3 -0
- package/lib/module/headless/index.js +29 -0
- package/lib/module/headless/index.js.map +1 -0
- package/lib/module/mock/index.d.ts +1 -2
- package/lib/module/mock/index.js +0 -3
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +7 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.d.ts +2 -1
- package/lib/module/renderer/Container.js +2 -0
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +5 -4
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Reconciler.d.ts +1 -1
- package/lib/module/renderer/Reconciler.js +2 -1
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.d.ts +4 -1
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +8 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +8 -0
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +5 -0
- package/lib/typescript/src/external/reanimated/useSharedValueEffect.d.ts +2 -5
- package/lib/typescript/src/headless/index.d.ts +3 -0
- package/lib/typescript/src/mock/index.d.ts +1 -2
- package/lib/typescript/src/renderer/Container.d.ts +2 -1
- package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +4 -1
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +7 -26
- package/src/external/reanimated/index.ts +1 -0
- package/src/external/reanimated/moduleWrapper.ts +62 -0
- package/src/external/reanimated/renderHelpers.ts +74 -0
- package/src/external/reanimated/useSharedValueEffect.ts +17 -23
- package/src/headless/index.ts +31 -0
- package/src/mock/index.ts +0 -5
- package/src/renderer/Canvas.tsx +6 -2
- package/src/renderer/Container.tsx +2 -1
- package/src/renderer/HostConfig.ts +8 -2
- package/src/renderer/Reconciler.tsx +3 -2
- package/src/renderer/processors/Animations/Animations.ts +9 -1
- package/src/skia/web/JsiSkSurfaceFactory.ts +6 -3
@@ -31,10 +31,11 @@ export class SkiaRoot {
|
|
31
31
|
constructor(
|
32
32
|
Skia: Skia,
|
33
33
|
registerValues: RegisterValues = () => () => {},
|
34
|
-
redraw: () => void = () => {}
|
34
|
+
redraw: () => void = () => {},
|
35
|
+
getNativeId: () => number = () => 0
|
35
36
|
) {
|
36
37
|
const depMgr = createDependencyManager(registerValues);
|
37
|
-
this.container = new Container(Skia, depMgr, redraw);
|
38
|
+
this.container = new Container(Skia, depMgr, redraw, getNativeId);
|
38
39
|
this.root = skiaReconciler.createContainer(
|
39
40
|
this.container,
|
40
41
|
0,
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import type { SkiaSelector, SkiaValue } from "../../../values";
|
2
2
|
|
3
|
+
export type SharedValueType<T = number> = {
|
4
|
+
value: T;
|
5
|
+
};
|
6
|
+
|
3
7
|
export const isValue = (value: unknown): value is SkiaValue<unknown> => {
|
4
8
|
if (value === undefined || value === null) {
|
5
9
|
return false;
|
@@ -44,7 +48,11 @@ export const isAnimated = <T>(props: AnimatedProps<T>) => {
|
|
44
48
|
};
|
45
49
|
|
46
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
47
|
-
export type AnimatedProp<T, P = any> =
|
51
|
+
export type AnimatedProp<T, P = any> =
|
52
|
+
| T
|
53
|
+
| SkiaValue<T>
|
54
|
+
| SkiaSelector<T, P>
|
55
|
+
| SharedValueType<T>;
|
48
56
|
|
49
57
|
export type AnimatedProps<T, O extends keyof T | never = never> = {
|
50
58
|
[K in keyof T]: K extends "children"
|
@@ -27,9 +27,12 @@ export class JsiSkSurfaceFactory extends Host implements SurfaceFactory {
|
|
27
27
|
surface = this.CanvasKit.MakeSurface(width, height);
|
28
28
|
} else {
|
29
29
|
const offscreen = new OC(width, height);
|
30
|
-
|
31
|
-
|
32
|
-
)
|
30
|
+
const webglContext = this.CanvasKit.GetWebGLContext(offscreen);
|
31
|
+
const grContext = this.CanvasKit.MakeWebGLContext(webglContext);
|
32
|
+
if (!grContext) {
|
33
|
+
throw new Error("Could not make a graphics context");
|
34
|
+
}
|
35
|
+
surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);
|
33
36
|
}
|
34
37
|
if (!surface) {
|
35
38
|
return null;
|