UNPKG

1.53 kBTypeScriptView Raw
1import * as React from 'react';
2import { BaseGLViewProps, ComponentOrHandle, GLSnapshot, SnapshotOptions } from './GLView.types';
3export interface GLViewProps extends BaseGLViewProps {
4 onContextCreate: (gl: WebGLRenderingContext) => void;
5 onContextRestored?: (gl?: WebGLRenderingContext) => void;
6 onContextLost?: () => void;
7 webglContextAttributes?: WebGLContextAttributes;
8 /**
9 * [iOS only] Number of samples for Apple's built-in multisampling.
10 */
11 msaaSamples: number;
12 /**
13 * A ref callback for the native GLView
14 */
15 nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | HTMLCanvasElement | null): any;
16}
17export declare class GLView extends React.Component<GLViewProps> {
18 canvas?: HTMLCanvasElement;
19 gl?: WebGLRenderingContext;
20 static createContextAsync(): Promise<WebGLRenderingContext | null>;
21 static destroyContextAsync(exgl?: WebGLRenderingContext | number): Promise<boolean>;
22 static takeSnapshotAsync(gl: WebGLRenderingContext, options?: SnapshotOptions): Promise<GLSnapshot>;
23 componentWillUnmount(): void;
24 render(): JSX.Element;
25 componentDidUpdate(prevProps: GLViewProps): void;
26 private getGLContextOrReject;
27 private onContextLost;
28 private onContextRestored;
29 private getGLContext;
30 private setCanvasRef;
31 takeSnapshotAsync(options?: SnapshotOptions): Promise<GLSnapshot>;
32 startARSessionAsync(): Promise<void>;
33 createCameraTextureAsync(): Promise<void>;
34 destroyObjectAsync(glObject: WebGLObject): Promise<void>;
35}