import type { RefAttributes, Component } from 'react'; import type { default as WebView } from 'react-native-webview'; import { WebViewSharedProps } from 'react-native-webview/lib/WebViewTypes'; export type DOMBackendHandlers = Pick< WebViewSharedProps, | 'onError' | 'onLoad' | 'onLoadEnd' | 'onLoadProgress' | 'onLoadStart' | 'onMessage' | 'onNavigationStateChange' | 'onShouldStartLoadWithRequest' >; export type DOMBackendProps = Omit< WebViewSharedProps, keyof DOMBackendHandlers > & { domHandlers: DOMBackendHandlers; } & O; export type DOMBackendState = 'loading' | 'loaded'; export type DocumentShape = { [k in string]: any; }; export type WindowShape = { [k in string]: any; } & { document: DocumentShape }; export type DOMBackendHandle< D extends DocumentShape = DocumentShape, W extends WindowShape = WindowShape > = Pick< WebView, | 'goBack' | 'goForward' | 'injectJavaScript' | 'reload' | 'requestFocus' | 'stopLoading' > & { getDocument(): D | null; getWindow(): W | null; }; export interface ComponentInstanceWithRef extends Component, H {} export interface ComponentClassWithHandle extends ComponentClass

{ new (props: P, context?: any): ComponentInstanceWithRef; } export interface FunctionComponentWithRef extends React.ForwardRefExoticComponent

> {} export type ComponentTypeWithRef = | ComponentClassWithHandle | FunctionComponentWithRef; export interface DOMBackendComponentInstance extends Component, any>, DOMBackendHandle {} export interface DOMBackendComponentClass extends ComponentClassWithHandle> {} export interface DOMBackendFunctionComponent extends FunctionComponentWithRef> {} export type DOMBackendComponent = | DOMBackendComponentClass | DOMBackendFunctionComponent;