@shopify/react-native-skia
Version:
High-performance React Native Graphics using Skia
68 lines (67 loc) • 2.38 kB
TypeScript
import React from "react";
import type { PointerEvent } from "react";
import type { SkRect, SkCanvas } from "../skia/types";
import type { SkiaValue } from "../values";
import type { DrawMode, SkiaBaseViewProps, TouchInfo } from "./types";
import { TouchType } from "./types";
export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps> extends React.Component<TProps> {
constructor(props: TProps);
private _surface;
private _unsubscriptions;
private _touches;
private _canvas;
private _canvasRef;
private _mode;
private _redrawRequests;
private requestId;
protected width: number;
protected height: number;
private unsubscribeAll;
private onLayoutEvent;
protected getSize(): {
width: number;
height: number;
};
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
/**
* Creates a snapshot from the canvas in the surface
* @param rect Rect to use as bounds. Optional.
* @returns An Image object.
*/
makeImageSnapshot(rect?: SkRect): import("../skia/types").SkImage | undefined;
/**
* Override to render
*/
protected abstract renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void;
/**
* Sends a redraw request to the native SkiaView.
*/
private tick;
redraw(): void;
/**
* Updates the drawing mode for the skia view. This is the same
* as declaratively setting the mode property on the SkiaView.
* There are two drawing modes, "continuous" and "default",
* where the continuous mode will continuously redraw the view and
* the default mode will only redraw when any of the regular react
* properties are changed like size and margins.
* @param mode Drawing mode to use.
*/
setDrawMode(mode: DrawMode): void;
/**
* Registers one or move values as a dependant value of the Skia View. The view will
* The view will redraw itself when any of the values change.
* @param values Values to register
*/
registerValues(_values: SkiaValue<unknown>[]): void;
private handleTouchEvent;
createTouchHandler(touchType: TouchType): (evt: PointerEvent) => void;
private onStart;
private onActive;
private onCancel;
private onEnd;
private onLayout;
render(): React.JSX.Element;
}