UNPKG

2.19 kBTypeScriptView Raw
1import PropTypes from 'prop-types';
2import React from 'react';
3import { BaseGLViewProps, GLSnapshot, ExpoWebGLRenderingContext, SnapshotOptions } from './GLView.types';
4export { BaseGLViewProps, ExpoWebGLRenderingContext, SnapshotOptions, GLViewProps };
5interface GLViewProps extends BaseGLViewProps {
6 onContextCreate: (gl: WebGLRenderingContext) => void;
7 onContextRestored?: (gl?: WebGLRenderingContext) => void;
8 onContextLost?: () => void;
9 webglContextAttributes?: WebGLContextAttributes;
10}
11declare type State = {
12 width: number;
13 height: number;
14};
15export declare class GLView extends React.Component<GLViewProps, State> {
16 state: {
17 width: number;
18 height: number;
19 };
20 static propTypes: {
21 onContextCreate: PropTypes.Validator<(...args: any[]) => any>;
22 onContextRestored: PropTypes.Requireable<(...args: any[]) => any>;
23 onContextLost: PropTypes.Requireable<(...args: any[]) => any>;
24 webglContextAttributes: PropTypes.Requireable<object>;
25 };
26 _hasContextBeenCreated: boolean;
27 _webglContextAttributes: WebGLContextAttributes | undefined;
28 canvas: HTMLCanvasElement | undefined;
29 container?: HTMLElement;
30 gl?: WebGLRenderingContext;
31 static createContextAsync(): Promise<WebGLRenderingContext>;
32 static destroyContextAsync(exgl?: WebGLRenderingContext | number): Promise<boolean>;
33 static takeSnapshotAsync(exgl: WebGLRenderingContext, options?: SnapshotOptions): Promise<GLSnapshot>;
34 componentDidMount(): void;
35 _contextCreated: () => void;
36 componentWillUnmount(): void;
37 _updateLayout: () => void;
38 render(): JSX.Element;
39 componentDidUpdate(): void;
40 _createContext(): WebGLRenderingContext;
41 _getGlOrReject(): WebGLRenderingContext;
42 _contextLost: (event: Event) => void;
43 _contextRestored: () => void;
44 _assignCanvasRef: (canvas: HTMLCanvasElement) => void;
45 _assignContainerRef: (element: HTMLElement | null) => void;
46 takeSnapshotAsync(options?: SnapshotOptions): Promise<GLSnapshot>;
47 startARSessionAsync(): Promise<void>;
48 createCameraTextureAsync(): Promise<void>;
49 destroyObjectAsync(glObject: WebGLObject): Promise<void>;
50}