@shopify/react-native-skia 2.4.6 → 2.4.14
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.
- package/android/cpp/jni/JniPlatformContext.cpp +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +11 -1
- package/apple/RNSkApplePlatformContext.h +4 -0
- package/apple/RNSkApplePlatformContext.mm +69 -0
- package/apple/SkiaCVPixelBufferUtils.mm +8 -4
- package/cpp/api/JsiSkFontMgr.h +30 -6
- package/cpp/api/JsiSkImageFilterFactory.h +4 -2
- package/cpp/api/JsiSkPictureFactory.h +9 -6
- package/cpp/api/recorder/RNRecorder.h +33 -55
- package/cpp/rnskia/RNSkPictureView.h +7 -5
- package/cpp/rnskia/RNSkPlatformContext.h +16 -0
- package/cpp/skia/include/codec/SkAndroidCodec.h +3 -2
- package/cpp/skia/include/codec/SkAvifDecoder.h +2 -2
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +2 -8
- package/cpp/skia/include/codec/SkEncodedOrigin.h +17 -0
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
- package/cpp/skia/include/codec/SkJpegDecoder.h +8 -1
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
- package/cpp/skia/include/codec/SkPngDecoder.h +8 -1
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
- package/cpp/skia/include/codec/SkWebpDecoder.h +8 -1
- package/cpp/skia/include/core/SkCPURecorder.h +1 -0
- package/cpp/skia/include/core/SkCanvas.h +3 -2
- package/cpp/skia/include/core/SkColorTable.h +1 -1
- package/cpp/skia/include/core/SkColorType.h +4 -0
- package/cpp/skia/include/core/SkDocument.h +1 -1
- package/cpp/skia/include/core/SkGraphics.h +7 -2
- package/cpp/skia/include/core/SkImage.h +5 -1
- package/cpp/skia/include/core/SkImageGenerator.h +5 -3
- package/cpp/skia/include/core/SkM44.h +3 -3
- package/cpp/skia/include/core/SkMatrix.h +0 -23
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOverdrawCanvas.h +1 -1
- package/cpp/skia/include/core/SkPath.h +216 -185
- package/cpp/skia/include/core/SkPathBuilder.h +97 -47
- package/cpp/skia/include/core/SkPathTypes.h +7 -1
- package/cpp/skia/include/core/SkPixmap.h +8 -8
- package/cpp/skia/include/core/SkRRect.h +24 -3
- package/cpp/skia/include/core/SkRecorder.h +3 -1
- package/cpp/skia/include/core/SkScalar.h +1 -1
- package/cpp/skia/include/core/SkSerialProcs.h +8 -4
- package/cpp/skia/include/core/SkStream.h +16 -9
- package/cpp/skia/include/core/SkString.h +1 -1
- package/cpp/skia/include/core/SkStrokeRec.h +1 -1
- package/cpp/skia/include/core/SkYUVAInfo.h +3 -0
- package/cpp/skia/include/docs/SkPDFDocument.h +1 -1
- package/cpp/skia/include/docs/SkPDFJpegHelpers.h +1 -1
- package/cpp/skia/include/docs/SkXPSDocument.h +18 -2
- package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -1
- package/cpp/skia/include/encode/SkPngRustEncoder.h +18 -0
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +7 -6
- package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +6 -0
- package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +2 -4
- package/cpp/skia/include/gpu/graphite/Context.h +15 -1
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +52 -11
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +44 -0
- package/cpp/skia/include/gpu/graphite/LogPriority.h +1 -1
- package/cpp/skia/include/gpu/graphite/PersistentPipelineStorage.h +45 -0
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +1 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +14 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +13 -5
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +1 -4
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -4
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +2 -8
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +124 -9
- package/cpp/skia/include/ports/SkFontMgr_fuchsia.h +3 -1
- package/cpp/skia/include/ports/SkImageGeneratorCG.h +1 -1
- package/cpp/skia/include/ports/SkImageGeneratorNDK.h +1 -1
- package/cpp/skia/include/ports/SkImageGeneratorWIC.h +1 -1
- package/cpp/skia/include/ports/SkTypeface_fontations.h +1 -1
- package/cpp/skia/include/private/SkEncodedInfo.h +38 -29
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +18 -13
- package/cpp/skia/include/private/SkPathRef.h +3 -6
- package/cpp/skia/include/private/base/SkAlign.h +3 -7
- package/cpp/skia/include/private/base/SkContainers.h +1 -1
- package/cpp/skia/include/private/base/SkSpan_impl.h +29 -0
- package/cpp/skia/include/private/base/SkTArray.h +7 -8
- package/cpp/skia/include/private/base/SkTDArray.h +4 -4
- package/cpp/skia/include/private/base/SkTemplates.h +5 -5
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -5
- package/cpp/skia/include/svg/SkSVGCanvas.h +21 -1
- package/cpp/skia/include/utils/SkNoDrawCanvas.h +1 -1
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -1
- package/cpp/skia/modules/skcms/src/skcms_public.h +29 -4
- package/cpp/skia/modules/skottie/include/Skottie.h +11 -0
- package/cpp/skia/modules/skottie/include/SlotManager.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Metrics.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGMerge.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGPath.h +1 -1
- package/cpp/skia/modules/skshaper/include/SkShaper.h +2 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +4 -4
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComponentTransfer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
- package/lib/commonjs/skia/core/Font.js +7 -1
- package/lib/commonjs/skia/core/Font.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +1 -7
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.d.ts +4 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +7 -2
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/skia/core/Font.js +7 -1
- package/lib/module/skia/core/Font.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +1 -7
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +1 -1
- package/lib/module/views/SkiaPictureView.web.d.ts +4 -1
- package/lib/module/views/SkiaPictureView.web.js +7 -3
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/core/Font.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +1 -11
- package/lib/typescript/lib/commonjs/views/SkiaPictureView.web.d.ts +1 -1
- package/lib/typescript/lib/module/mock/index.d.ts +1 -1
- package/lib/typescript/lib/module/skia/core/Font.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +1 -1
- package/lib/typescript/lib/module/views/SkiaPictureView.web.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +1 -1
- package/lib/typescript/src/views/SkiaPictureView.web.d.ts +4 -1
- package/package.json +8 -8
- package/scripts/install-skia.mjs +74 -1
- package/src/skia/core/Font.ts +9 -4
- package/src/skia/web/JsiSkCanvas.ts +1 -3
- package/src/views/SkiaPictureView.web.tsx +8 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export function useFont(font: any, size: number | undefined, onError: any): import("../../../..").SkFont | null;
|
|
2
2
|
export function matchFont(inputStyle?: {}, fontMgr?: import("../../../..").SkFontMgr): import("../../../..").SkFont;
|
|
3
|
-
export function listFontFamilies(fontMgr?: import("../../../..").SkFontMgr):
|
|
3
|
+
export function listFontFamilies(fontMgr?: import("../../../..").SkFontMgr): any[];
|
|
4
4
|
export function useFonts(sources: any): null;
|
|
@@ -24,7 +24,7 @@ export class JsiSkCanvas extends HostObject {
|
|
|
24
24
|
drawText(str: any, x: any, y: any, paint: any, font: any): void;
|
|
25
25
|
drawTextBlob(blob: any, x: any, y: any, paint: any): void;
|
|
26
26
|
drawGlyphs(glyphs: any, positions: any, x: any, y: any, font: any, paint: any): void;
|
|
27
|
-
drawSvg(svg: any,
|
|
27
|
+
drawSvg(svg: any, _width: any, _height: any): void;
|
|
28
28
|
save(): any;
|
|
29
29
|
saveLayer(paint: any, bounds: any, backdrop: any, flags: any): any;
|
|
30
30
|
restore(): void;
|
|
@@ -5,4 +5,4 @@ declare function SkiaPictureViewNativeComponent({ nativeID, debug, opaque, onLay
|
|
|
5
5
|
debug: any;
|
|
6
6
|
opaque: any;
|
|
7
7
|
onLayout: any;
|
|
8
|
-
}): import("react").
|
|
8
|
+
}): import("react").FunctionComponentElement<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function SkiaPictureView(props: any): React.CElement<import("react-native").ViewProps, import("react-native").View>;
|
|
2
2
|
import React from "react";
|
|
@@ -27,7 +27,7 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
|
|
|
27
27
|
drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont): void;
|
|
28
28
|
drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint): void;
|
|
29
29
|
drawGlyphs(glyphs: number[], positions: SkPoint[], x: number, y: number, font: SkFont, paint: SkPaint): void;
|
|
30
|
-
drawSvg(svg: SkSVG,
|
|
30
|
+
drawSvg(svg: SkSVG, _width?: number, _height?: number): void;
|
|
31
31
|
save(): number;
|
|
32
32
|
saveLayer(paint?: SkPaint, bounds?: SkRect | null, backdrop?: SkImageFilter | null, flags?: SaveLayerFlag): number;
|
|
33
33
|
restore(): void;
|
|
@@ -4,5 +4,5 @@ export interface NativeProps extends ViewProps {
|
|
|
4
4
|
opaque?: boolean;
|
|
5
5
|
nativeID: string;
|
|
6
6
|
}
|
|
7
|
-
declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("
|
|
7
|
+
declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaPictureView.web").SkiaPictureViewProps>;
|
|
8
8
|
export default SkiaPictureViewNativeComponent;
|
|
@@ -12,4 +12,7 @@ export interface SkiaPictureViewHandle {
|
|
|
12
12
|
measure(callback: (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void): void;
|
|
13
13
|
measureInWindow(callback: (x: number, y: number, width: number, height: number) => void): void;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {
|
|
16
|
+
ref?: React.Ref<SkiaPictureViewHandle>;
|
|
17
|
+
}
|
|
18
|
+
export declare const SkiaPictureView: (props: SkiaPictureViewProps) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
|
9
9
|
},
|
|
10
10
|
"title": "React Native Skia",
|
|
11
|
-
"version": "2.4.
|
|
11
|
+
"version": "2.4.14",
|
|
12
12
|
"skia": {
|
|
13
|
-
"version": "
|
|
13
|
+
"version": "m144",
|
|
14
14
|
"checksums": {
|
|
15
|
-
"android-armeabi-v7a": "
|
|
16
|
-
"android-arm64-v8a": "
|
|
17
|
-
"android-x86": "
|
|
18
|
-
"android-x86_64": "
|
|
19
|
-
"apple-xcframeworks": "
|
|
15
|
+
"android-armeabi-v7a": "8f7f83a4ae210cc28007f2c226d754e9ef7c929822ef60c56a4ccc134e726148",
|
|
16
|
+
"android-arm64-v8a": "5d799d988a6cbc0cb844a92882a2458e67990314791ea38f928d83d5e01cb828",
|
|
17
|
+
"android-x86": "711fbee4a1721b92604daa78fa6f8c7ce4a6a6c901973919bd030848adc4f81d",
|
|
18
|
+
"android-x86_64": "fe068aa70b5c8bcf991cfe99e9db38617aaeaf92defd08bc4f89384b4d4dbed4",
|
|
19
|
+
"apple-xcframeworks": "63e2789bd75236b16779abc7171b351aa50cd01c13f05b3e1d83b34336ceb77c"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"skia-graphite": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"android-arm64-v8a": "6be2711ca4c31523d381420e98cabfe7e7939e246975c7b427968d5dd3b62be9",
|
|
27
27
|
"android-x86": "888934ddc34f431c7fac5628f633dc11a4e84d68c41adb33307ae7586cc7b0b5",
|
|
28
28
|
"android-x86_64": "2180a5be52d51bbf1dabaf95051ed0ce422b047157bcda6e486657c2c7b87ceb",
|
|
29
|
-
"apple-xcframeworks": "
|
|
29
|
+
"apple-xcframeworks": "6c9e4c565977acaf9d4f4b113050cfe8f9804602fd3cd4ec982c605fa7b040e6"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"description": "High-performance React Native Graphics using Skia",
|
package/scripts/install-skia.mjs
CHANGED
|
@@ -59,10 +59,11 @@ console.log(
|
|
|
59
59
|
`📦 Downloading Skia prebuilt binaries for ${releaseTag}`
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
const runCommand = (command, args) => {
|
|
62
|
+
const runCommand = (command, args, options = {}) => {
|
|
63
63
|
return new Promise((resolve, reject) => {
|
|
64
64
|
const child = spawn(command, args, {
|
|
65
65
|
stdio: ["ignore", "inherit", "inherit"],
|
|
66
|
+
...options,
|
|
66
67
|
});
|
|
67
68
|
child.on("error", (error) => {
|
|
68
69
|
reject(error);
|
|
@@ -77,6 +78,75 @@ const runCommand = (command, args) => {
|
|
|
77
78
|
});
|
|
78
79
|
};
|
|
79
80
|
|
|
81
|
+
const runCommandWithOutput = (command, args, options = {}) => {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const child = spawn(command, args, {
|
|
84
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
85
|
+
...options,
|
|
86
|
+
});
|
|
87
|
+
let stdout = "";
|
|
88
|
+
let stderr = "";
|
|
89
|
+
child.stdout.on("data", (data) => {
|
|
90
|
+
stdout += data.toString();
|
|
91
|
+
});
|
|
92
|
+
child.stderr.on("data", (data) => {
|
|
93
|
+
stderr += data.toString();
|
|
94
|
+
});
|
|
95
|
+
child.on("error", (error) => {
|
|
96
|
+
reject(error);
|
|
97
|
+
});
|
|
98
|
+
child.on("close", (code) => {
|
|
99
|
+
if (code === 0) {
|
|
100
|
+
resolve(stdout.trim());
|
|
101
|
+
} else {
|
|
102
|
+
reject(new Error(`Command ${command} exited with code ${code}: ${stderr}`));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const skiaDir = path.resolve(__dirname, "../../../externals/skia");
|
|
109
|
+
|
|
110
|
+
const checkoutSkiaBranch = async (version) => {
|
|
111
|
+
const branchName = `chrome/${version}`;
|
|
112
|
+
|
|
113
|
+
// Check if the skia directory exists and is a git repo
|
|
114
|
+
// (won't exist when installed via npm - submodule is not included in the package)
|
|
115
|
+
if (!fs.existsSync(skiaDir) || !fs.existsSync(path.join(skiaDir, ".git"))) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log(`🔀 Checking out Skia branch: ${branchName}`);
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
// Get current branch/commit
|
|
123
|
+
const currentRef = await runCommandWithOutput("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd: skiaDir });
|
|
124
|
+
|
|
125
|
+
if (currentRef === branchName) {
|
|
126
|
+
console.log(` ✓ Already on branch ${branchName}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Fetch the branch from origin
|
|
131
|
+
console.log(` Fetching branch ${branchName} from origin...`);
|
|
132
|
+
try {
|
|
133
|
+
await runCommand("git", ["fetch", "origin", `${branchName}:${branchName}`], { cwd: skiaDir });
|
|
134
|
+
} catch (e) {
|
|
135
|
+
// Branch might already exist locally, try to update it
|
|
136
|
+
await runCommand("git", ["fetch", "origin", branchName], { cwd: skiaDir });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Checkout the branch (use -f to discard local changes in the submodule)
|
|
140
|
+
console.log(` Checking out ${branchName}...`);
|
|
141
|
+
await runCommand("git", ["checkout", "-f", branchName], { cwd: skiaDir });
|
|
142
|
+
|
|
143
|
+
console.log(` ✓ Successfully checked out ${branchName}`);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.error(` ⚠️ Failed to checkout branch ${branchName}: ${error.message}`);
|
|
146
|
+
console.error(" Headers may not match the prebuilt binaries!");
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
80
150
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
81
151
|
|
|
82
152
|
const downloadToFile = (url, destPath, maxRetries = 5) => {
|
|
@@ -359,6 +429,9 @@ const clearDirectory = (directory) => {
|
|
|
359
429
|
};
|
|
360
430
|
|
|
361
431
|
const main = async () => {
|
|
432
|
+
// Ensure the skia submodule is on the correct branch for copying headers
|
|
433
|
+
await checkoutSkiaBranch(skiaVersion);
|
|
434
|
+
|
|
362
435
|
// Check if binaries are installed and checksums match
|
|
363
436
|
if (areBinariesInstalled() && verifyChecksums()) {
|
|
364
437
|
console.log("✅ Prebuilt binaries already installed with matching checksums, skipping download");
|
package/src/skia/core/Font.ts
CHANGED
|
@@ -95,10 +95,15 @@ export const matchFont = (
|
|
|
95
95
|
return Skia.Font(typeface, fontStyle.fontSize);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
export const listFontFamilies = (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
export const listFontFamilies = (
|
|
99
|
+
fontMgr: SkFontMgr = Skia.FontMgr.System()
|
|
100
|
+
) => {
|
|
101
|
+
const families = new Set<string>();
|
|
102
|
+
for (let i = 0; i < fontMgr.countFamilies(); i++) {
|
|
103
|
+
families.add(fontMgr.getFamilyName(i));
|
|
104
|
+
}
|
|
105
|
+
return Array.from(families);
|
|
106
|
+
};
|
|
102
107
|
|
|
103
108
|
const loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {
|
|
104
109
|
const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {
|
|
@@ -312,9 +312,7 @@ export class JsiSkCanvas
|
|
|
312
312
|
);
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
drawSvg(svg: SkSVG,
|
|
316
|
-
const ctm = this.ref.getLocalToDevice();
|
|
317
|
-
console.log({ ctm, width, height });
|
|
315
|
+
drawSvg(svg: SkSVG, _width?: number, _height?: number) {
|
|
318
316
|
const image = this.CanvasKit.MakeImageFromCanvasImageSource(
|
|
319
317
|
(svg as JsiSkSVG).ref
|
|
320
318
|
);
|
|
@@ -4,7 +4,6 @@ import React, {
|
|
|
4
4
|
useEffect,
|
|
5
5
|
useCallback,
|
|
6
6
|
useImperativeHandle,
|
|
7
|
-
forwardRef,
|
|
8
7
|
} from "react";
|
|
9
8
|
import type { LayoutChangeEvent } from "react-native";
|
|
10
9
|
|
|
@@ -239,10 +238,12 @@ export interface SkiaPictureViewHandle {
|
|
|
239
238
|
): void;
|
|
240
239
|
}
|
|
241
240
|
|
|
242
|
-
export
|
|
243
|
-
SkiaPictureViewHandle
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
export interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {
|
|
242
|
+
ref?: React.Ref<SkiaPictureViewHandle>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const SkiaPictureView = (props: SkiaPictureViewProps) => {
|
|
246
|
+
const { ref } = props;
|
|
246
247
|
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
|
247
248
|
const renderer = useRef<Renderer | null>(null);
|
|
248
249
|
const redrawRequestsRef = useRef(0);
|
|
@@ -415,10 +416,10 @@ export const SkiaPictureView = forwardRef<
|
|
|
415
416
|
}
|
|
416
417
|
}, [picture, redraw]);
|
|
417
418
|
|
|
418
|
-
const { debug = false, ...viewProps } = props;
|
|
419
|
+
const { debug = false, ref: _ref, ...viewProps } = props;
|
|
419
420
|
return (
|
|
420
421
|
<Platform.View {...viewProps} onLayout={onLayoutEvent}>
|
|
421
422
|
<canvas ref={canvasRef} style={{ display: "flex", flex: 1 }} />
|
|
422
423
|
</Platform.View>
|
|
423
424
|
);
|
|
424
|
-
}
|
|
425
|
+
};
|