UNPKG

8.23 kBTypeScriptView Raw
1import * as React from 'react';
2import PropTypes from 'prop-types';
3import { SurfaceCreateEvent, GLSnapshot, ExpoWebGLRenderingContext, SnapshotOptions, BaseGLViewProps } from './GLView.types';
4declare type GLViewProps = {
5 /**
6 * Called when the OpenGL context is created, with the context object as a parameter. The context
7 * object has an API mirroring WebGL's WebGLRenderingContext.
8 */
9 onContextCreate(gl: ExpoWebGLRenderingContext): void;
10 /**
11 * [iOS only] Number of samples for Apple's built-in multisampling.
12 */
13 msaaSamples: number;
14 /**
15 * A ref callback for the native GLView
16 */
17 nativeRef_EXPERIMENTAL?(callback: ComponentOrHandle | null): any;
18} & BaseGLViewProps;
19declare type ComponentOrHandle = null | number | React.Component<any, any> | React.ComponentClass<any>;
20/**
21 * A component that acts as an OpenGL render target
22 */
23export declare class GLView extends React.Component<GLViewProps> {
24 static NativeView: any;
25 static propTypes: {
26 hitSlop?: PropTypes.Validator<import("react-native").Insets | undefined> | undefined;
27 onLayout?: PropTypes.Validator<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
28 pointerEvents?: PropTypes.Validator<"box-none" | "none" | "box-only" | "auto" | undefined> | undefined;
29 removeClippedSubviews?: PropTypes.Validator<boolean | undefined> | undefined;
30 style?: PropTypes.Validator<import("react-native").StyleProp<import("react-native").ViewStyle>> | undefined;
31 testID?: PropTypes.Validator<string | undefined> | undefined;
32 nativeID?: PropTypes.Validator<string | undefined> | undefined;
33 collapsable?: PropTypes.Validator<boolean | undefined> | undefined;
34 needsOffscreenAlphaCompositing?: PropTypes.Validator<boolean | undefined> | undefined;
35 renderToHardwareTextureAndroid?: PropTypes.Validator<boolean | undefined> | undefined;
36 accessibilityViewIsModal?: PropTypes.Validator<boolean | undefined> | undefined;
37 accessibilityActions?: PropTypes.Validator<string[] | undefined> | undefined;
38 onAccessibilityAction?: PropTypes.Validator<(() => void) | undefined> | undefined;
39 shouldRasterizeIOS?: PropTypes.Validator<boolean | undefined> | undefined;
40 isTVSelectable?: PropTypes.Validator<boolean | undefined> | undefined;
41 hasTVPreferredFocus?: PropTypes.Validator<boolean | undefined> | undefined;
42 tvParallaxProperties?: PropTypes.Validator<import("react-native").TVParallaxProperties | undefined> | undefined;
43 tvParallaxShiftDistanceX?: PropTypes.Validator<number | undefined> | undefined;
44 tvParallaxShiftDistanceY?: PropTypes.Validator<number | undefined> | undefined;
45 tvParallaxTiltAngle?: PropTypes.Validator<number | undefined> | undefined;
46 tvParallaxMagnification?: PropTypes.Validator<number | undefined> | undefined;
47 onStartShouldSetResponder?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => boolean) | undefined> | undefined;
48 onMoveShouldSetResponder?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => boolean) | undefined> | undefined;
49 onResponderEnd?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
50 onResponderGrant?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
51 onResponderReject?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
52 onResponderMove?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
53 onResponderRelease?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
54 onResponderStart?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
55 onResponderTerminationRequest?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => boolean) | undefined> | undefined;
56 onResponderTerminate?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
57 onStartShouldSetResponderCapture?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => boolean) | undefined> | undefined;
58 onMoveShouldSetResponderCapture?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => boolean) | undefined> | undefined;
59 onTouchStart?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
60 onTouchMove?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
61 onTouchEnd?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
62 onTouchCancel?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
63 onTouchEndCapture?: PropTypes.Validator<((event: import("react-native").GestureResponderEvent) => void) | undefined> | undefined;
64 accessible?: PropTypes.Validator<boolean | undefined> | undefined;
65 accessibilityLabel?: PropTypes.Validator<string | undefined> | undefined;
66 accessibilityRole?: PropTypes.Validator<"none" | "button" | "link" | "search" | "image" | "keyboardkey" | "text" | "adjustable" | "header" | "summary" | "imagebutton" | undefined> | undefined;
67 accessibilityStates?: PropTypes.Validator<import("react-native").AccessibilityState[] | undefined> | undefined;
68 accessibilityHint?: PropTypes.Validator<string | undefined> | undefined;
69 accessibilityComponentType?: PropTypes.Validator<"none" | "button" | "radiobutton_checked" | "radiobutton_unchecked" | undefined> | undefined;
70 accessibilityLiveRegion?: PropTypes.Validator<"none" | "polite" | "assertive" | undefined> | undefined;
71 importantForAccessibility?: PropTypes.Validator<"auto" | "yes" | "no" | "no-hide-descendants" | undefined> | undefined;
72 accessibilityElementsHidden?: PropTypes.Validator<boolean | undefined> | undefined;
73 accessibilityTraits?: PropTypes.Validator<"none" | "button" | "link" | "search" | "image" | "text" | "adjustable" | "header" | "summary" | "selected" | "disabled" | "plays" | "key" | "frequentUpdates" | "startsMedia" | "allowsDirectInteraction" | "pageTurn" | import("react-native").AccessibilityTrait[] | undefined> | undefined;
74 onAccessibilityTap?: PropTypes.Validator<(() => void) | undefined> | undefined;
75 onMagicTap?: PropTypes.Validator<(() => void) | undefined> | undefined;
76 accessibilityIgnoresInvertColors?: PropTypes.Validator<boolean | undefined> | undefined;
77 onContextCreate: PropTypes.Requireable<(...args: any[]) => any>;
78 msaaSamples: PropTypes.Requireable<number>;
79 nativeRef_EXPERIMENTAL: PropTypes.Requireable<(...args: any[]) => any>;
80 };
81 static defaultProps: {
82 msaaSamples: number;
83 };
84 static createContextAsync(): Promise<ExpoWebGLRenderingContext>;
85 static destroyContextAsync(exgl?: ExpoWebGLRenderingContext | number): Promise<boolean>;
86 static takeSnapshotAsync(exgl?: ExpoWebGLRenderingContext | number, options?: SnapshotOptions): Promise<GLSnapshot>;
87 nativeRef: ComponentOrHandle;
88 exglCtxId?: number;
89 render(): JSX.Element;
90 _setNativeRef: (nativeRef: ComponentOrHandle) => void;
91 _onSurfaceCreate: ({ nativeEvent: { exglCtxId } }: SurfaceCreateEvent) => void;
92 startARSessionAsync(): Promise<any>;
93 createCameraTextureAsync(cameraRefOrHandle: ComponentOrHandle): Promise<WebGLTexture>;
94 destroyObjectAsync(glObject: WebGLObject): Promise<boolean>;
95 takeSnapshotAsync(options?: SnapshotOptions): Promise<GLSnapshot>;
96}
97declare type WebGLObjectId = any;
98declare class WebGLObject {
99 id: WebGLObjectId;
100 constructor(id: WebGLObjectId);
101 toString(): string;
102}
103declare class WebGLTexture extends WebGLObject {
104}
105export {};