UNPKG

@antv/f-react

Version:
61 lines (60 loc) 2.62 kB
import React, { RefObject } from 'react'; import { Canvas, CanvasProps as FCanvasProps } from '@antv/f-engine'; export interface CanvasProps { className?: string; pixelRatio?: number; width?: number | string; height?: number | string; padding?: (string | number)[]; animate?: boolean; canvasRef?: RefObject<HTMLCanvasElement>; ref?: RefObject<HTMLCanvasElement>; children?: React.ReactElement | React.ReactElement[] | null; fallback?: JSX.Element | null; onError?: (error: Error) => void; autoFit?: boolean; } export interface CanvasState { error: any; } declare const createCanvas: (CanvasClass: typeof Canvas) => { new (props: CanvasProps): { canvasRef: RefObject<HTMLCanvasElement>; canvas: Canvas; parentNode: { width: number; height: number; }; observer: ResizeObserver; catchError(error: any): void; getProps: () => FCanvasProps; componentDidMount(): void; observeElement(): void; resize(): void; componentDidUpdate(): void; render(): JSX.Element; componentWillUnmount(): void; destroy(): void; context: any; setState<K extends "error">(state: CanvasState | ((prevState: Readonly<CanvasState>, props: Readonly<CanvasProps>) => CanvasState | Pick<CanvasState, K>) | Pick<CanvasState, K>, callback?: () => void): void; forceUpdate(callback?: () => void): void; readonly props: Readonly<CanvasProps> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<CanvasState>; refs: { [key: string]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<CanvasProps>, nextState: Readonly<CanvasState>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<CanvasProps>, prevState: Readonly<CanvasState>): any; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<CanvasProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<CanvasProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<CanvasProps>, nextState: Readonly<CanvasState>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<CanvasProps>, nextState: Readonly<CanvasState>, nextContext: any): void; }; contextType?: React.Context<any>; }; export { createCanvas };