UNPKG

@shopify/react-native-skia

Version:

High-performance React Native Graphics using Skia

28 lines (22 loc) 535 B
import type { CanvasKit } from "canvaskit-wasm"; import type { SkSVG } from "../types"; import { HostObject } from "./Host"; export class JsiSkSVG extends HostObject<HTMLImageElement, "SVG"> implements SkSVG { constructor(CanvasKit: CanvasKit, ref: HTMLImageElement) { super(CanvasKit, ref, "SVG"); } width(): number { return this.ref.width; } height(): number { return this.ref.height; } dispose = () => { if (this.ref.parentNode) { this.ref.parentNode.removeChild(this.ref); } }; }