@shopify/react-native-skia 0.1.142 → 0.1.146
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkContourMeasure.h +4 -4
- package/cpp/api/JsiSkDataFactory.h +3 -3
- package/cpp/api/JsiSkFont.h +1 -1
- package/cpp/api/JsiSkPaint.h +6 -0
- package/cpp/api/JsiSkPathFactory.h +2 -2
- package/cpp/api/JsiSkPicture.h +7 -1
- package/cpp/api/JsiSkPictureFactory.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +6 -6
- package/cpp/api/JsiSkRuntimeEffectFactory.h +1 -1
- package/cpp/jsi/JsiSimpleValueWrapper.h +27 -27
- package/cpp/jsi/JsiValueWrapper.h +127 -0
- package/cpp/rnskia/RNSkDrawView.cpp +44 -20
- package/cpp/rnskia/RNSkDrawView.h +18 -20
- package/cpp/rnskia/RNSkJsiViewApi.h +180 -166
- package/cpp/rnskia/values/RNSkComputedValue.h +11 -11
- package/cpp/rnskia/values/RNSkReadonlyValue.h +19 -19
- package/cpp/rnskia/values/RNSkValue.h +13 -13
- package/cpp/utils/RNSkLog.h +4 -4
- package/lib/commonjs/renderer/Canvas.js +17 -7
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DependencyManager.js +144 -36
- package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +18 -2
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Blend.js +20 -5
- package/lib/commonjs/renderer/components/Blend.js.map +1 -1
- package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
- package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
- package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Node.js +9 -7
- package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.js +3 -22
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/Host.js +12 -21
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +46 -26
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +19 -6
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +9 -55
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
- package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
- package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
- package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +12 -6
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +11 -27
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/renderer/Canvas.js +17 -6
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DependencyManager.js +140 -33
- package/lib/module/renderer/DependencyManager.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +18 -2
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Blend.js +21 -5
- package/lib/module/renderer/components/Blend.js.map +1 -1
- package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
- package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
- package/lib/module/renderer/nodes/Declaration.js +3 -4
- package/lib/module/renderer/nodes/Declaration.js.map +1 -1
- package/lib/module/renderer/nodes/Drawing.js +3 -6
- package/lib/module/renderer/nodes/Drawing.js.map +1 -1
- package/lib/module/renderer/nodes/Node.js +9 -7
- package/lib/module/renderer/nodes/Node.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.js +1 -16
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/Host.js +9 -9
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +37 -27
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +4 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +15 -7
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +9 -57
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +4 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +10 -2
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +2 -2
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +2 -2
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +3 -2
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
- package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +10 -5
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/views/SkiaView.js +11 -26
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +0 -1
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
- package/lib/typescript/src/skia/web/Host.d.ts +6 -8
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
- package/lib/typescript/src/views/SkiaView.d.ts +1 -11
- package/lib/typescript/src/views/types.d.ts +5 -5
- 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/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 +2 -2
- package/src/renderer/Canvas.tsx +19 -7
- package/src/renderer/DependencyManager.tsx +170 -39
- package/src/renderer/HostConfig.ts +12 -2
- package/src/renderer/components/Blend.tsx +25 -5
- package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
- package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
- package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
- package/src/renderer/nodes/Declaration.tsx +6 -8
- package/src/renderer/nodes/Drawing.tsx +5 -7
- package/src/renderer/nodes/Node.ts +11 -9
- package/src/renderer/processors/Animations/Animations.ts +2 -15
- package/src/skia/types/Paint/Paint.ts +6 -0
- package/src/skia/types/Picture/Picture.ts +2 -1
- package/src/skia/web/Host.ts +12 -22
- package/src/skia/web/JsiSkCanvas.ts +78 -47
- package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
- package/src/skia/web/JsiSkFont.ts +11 -4
- package/src/skia/web/JsiSkImage.ts +4 -3
- package/src/skia/web/JsiSkImageFactory.ts +6 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
- package/src/skia/web/JsiSkMatrix.ts +4 -2
- package/src/skia/web/JsiSkPaint.ts +15 -7
- package/src/skia/web/JsiSkPath.ts +16 -51
- package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
- package/src/skia/web/JsiSkPathFactory.ts +3 -3
- package/src/skia/web/JsiSkPicture.ts +5 -3
- package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
- package/src/skia/web/JsiSkPoint.ts +12 -2
- package/src/skia/web/JsiSkRRect.ts +5 -2
- package/src/skia/web/JsiSkRSXform.ts +1 -1
- package/src/skia/web/JsiSkRect.ts +2 -2
- package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
- package/src/skia/web/JsiSkShaderFactory.ts +24 -15
- package/src/skia/web/JsiSkSurface.ts +7 -2
- package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
- package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
- package/src/skia/web/JsiSkia.ts +17 -5
- package/src/views/SkiaView.tsx +17 -28
- package/src/views/types.ts +7 -6
package/src/views/SkiaView.tsx
CHANGED
@@ -5,7 +5,7 @@ import type { SkRect } from "../skia/types";
|
|
5
5
|
import type { SkiaValue } from "../values";
|
6
6
|
|
7
7
|
import { SkiaViewApi } from "./api";
|
8
|
-
import type {
|
8
|
+
import type { NativeSkiaViewProps, SkiaViewProps } from "./types";
|
9
9
|
|
10
10
|
let SkiaViewNativeId = 1000;
|
11
11
|
|
@@ -19,8 +19,8 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
19
19
|
this._nativeId = SkiaViewNativeId++;
|
20
20
|
const { onDraw } = props;
|
21
21
|
if (onDraw) {
|
22
|
-
|
23
|
-
SkiaViewApi.
|
22
|
+
assertSkiaViewApi();
|
23
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "drawCallback", onDraw);
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
@@ -33,8 +33,8 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
33
33
|
componentDidUpdate(prevProps: SkiaViewProps) {
|
34
34
|
const { onDraw } = this.props;
|
35
35
|
if (onDraw !== prevProps.onDraw) {
|
36
|
-
|
37
|
-
SkiaViewApi.
|
36
|
+
assertSkiaViewApi();
|
37
|
+
SkiaViewApi.setJsiProperty(this._nativeId, "drawCallback", onDraw);
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
@@ -44,7 +44,7 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
44
44
|
* @returns An Image object.
|
45
45
|
*/
|
46
46
|
public makeImageSnapshot(rect?: SkRect) {
|
47
|
-
|
47
|
+
assertSkiaViewApi();
|
48
48
|
return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);
|
49
49
|
}
|
50
50
|
|
@@ -52,22 +52,8 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
52
52
|
* Sends a redraw request to the native SkiaView.
|
53
53
|
*/
|
54
54
|
public redraw() {
|
55
|
-
|
56
|
-
SkiaViewApi.
|
57
|
-
}
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Updates the drawing mode for the skia view. This is the same
|
61
|
-
* as declaratively setting the mode property on the SkiaView.
|
62
|
-
* There are two drawing modes, "continuous" and "default",
|
63
|
-
* where the continuous mode will continuously redraw the view and
|
64
|
-
* the default mode will only redraw when any of the regular react
|
65
|
-
* properties are changed like size and margins.
|
66
|
-
* @param mode Drawing mode to use.
|
67
|
-
*/
|
68
|
-
public setDrawMode(mode: DrawMode) {
|
69
|
-
assertDrawCallbacksEnabled();
|
70
|
-
SkiaViewApi.setDrawMode(this._nativeId, mode);
|
55
|
+
assertSkiaViewApi();
|
56
|
+
SkiaViewApi.requestRedraw(this._nativeId);
|
71
57
|
}
|
72
58
|
|
73
59
|
/**
|
@@ -75,8 +61,8 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
75
61
|
* The view will redraw itself when any of the values change.
|
76
62
|
* @param values Values to register
|
77
63
|
*/
|
78
|
-
public registerValues(values: SkiaValue<unknown>[]) {
|
79
|
-
|
64
|
+
public registerValues(values: SkiaValue<unknown>[]): () => void {
|
65
|
+
assertSkiaViewApi();
|
80
66
|
return SkiaViewApi.registerValuesInView(this._nativeId, values);
|
81
67
|
}
|
82
68
|
|
@@ -94,12 +80,15 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
94
80
|
}
|
95
81
|
}
|
96
82
|
|
97
|
-
const
|
83
|
+
const assertSkiaViewApi = () => {
|
98
84
|
if (
|
99
85
|
SkiaViewApi === null ||
|
100
|
-
SkiaViewApi.
|
101
|
-
SkiaViewApi.
|
86
|
+
SkiaViewApi.setJsiProperty === null ||
|
87
|
+
SkiaViewApi.callJsiMethod === null ||
|
88
|
+
SkiaViewApi.registerValuesInView === null ||
|
89
|
+
SkiaViewApi.requestRedraw === null ||
|
90
|
+
SkiaViewApi.makeImageSnapshot === null
|
102
91
|
) {
|
103
|
-
throw Error("Skia Api
|
92
|
+
throw Error("Skia View Api was not found.");
|
104
93
|
}
|
105
94
|
};
|
package/src/views/types.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ViewProps } from "react-native";
|
2
2
|
|
3
|
-
import type { SkImage, SkRect
|
3
|
+
import type { SkCanvas, SkImage, SkRect } from "../skia/types";
|
4
4
|
import type { SkiaValue } from "../values";
|
5
5
|
|
6
6
|
export type DrawMode = "continuous" | "default";
|
@@ -58,17 +58,18 @@ export interface ValueListener {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
export interface ISkiaViewApi {
|
61
|
-
|
62
|
-
|
63
|
-
setDrawCallback: (
|
61
|
+
setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
|
62
|
+
callJsiMethod: <T extends Array<unknown>>(
|
64
63
|
nativeId: number,
|
65
|
-
|
64
|
+
name: string,
|
65
|
+
...args: T
|
66
66
|
) => void;
|
67
|
-
setDrawMode: (nativeId: number, mode: DrawMode) => void;
|
68
67
|
registerValuesInView: (
|
69
68
|
nativeId: number,
|
70
69
|
values: SkiaValue<unknown>[]
|
71
70
|
) => () => void;
|
71
|
+
requestRedraw: (nativeId: number) => void;
|
72
|
+
makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
|
72
73
|
}
|
73
74
|
|
74
75
|
export interface SkiaViewProps extends ViewProps {
|