react-native-webview.git

WebView.android.d.ts 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React from 'react';
  2. import { NativeSyntheticEvent } from 'react-native';
  3. import { WebViewError, WebViewSharedProps, WebViewProgressEvent } from './types/WebViewTypes';
  4. declare enum WebViewState {
  5. IDLE = "IDLE",
  6. LOADING = "LOADING",
  7. ERROR = "ERROR"
  8. }
  9. declare type State = {
  10. viewState: WebViewState;
  11. lastErrorEvent: WebViewError | null;
  12. };
  13. /**
  14. * Renders a native WebView.
  15. */
  16. export default class WebView extends React.Component<WebViewSharedProps, State> {
  17. static defaultProps: {
  18. overScrollMode: string;
  19. javaScriptEnabled: boolean;
  20. thirdPartyCookiesEnabled: boolean;
  21. scalesPageToFit: boolean;
  22. allowFileAccess: boolean;
  23. saveFormDataDisabled: boolean;
  24. originWhitelist: string[];
  25. };
  26. static isFileUploadSupported: () => Promise<boolean>;
  27. state: State;
  28. webViewRef: React.RefObject<React.ComponentClass<{}, any>>;
  29. goForward: () => void;
  30. goBack: () => void;
  31. reload: () => void;
  32. stopLoading: () => void;
  33. postMessage: (data: string) => void;
  34. /**
  35. * Injects a javascript string into the referenced WebView. Deliberately does not
  36. * return a response because using eval() to return a response breaks this method
  37. * on pages with a Content Security Policy that disallows eval(). If you need that
  38. * functionality, look into postMessage/onMessage.
  39. */
  40. injectJavaScript: (data: string) => void;
  41. /**
  42. * We return an event with a bunch of fields including:
  43. * url, title, loading, canGoBack, canGoForward
  44. */
  45. updateNavigationState: (event: NativeSyntheticEvent<import("./types/WebViewTypes").WebViewNavigation>) => void;
  46. getWebViewHandle: () => number | null;
  47. onLoadingStart: (event: NativeSyntheticEvent<import("./types/WebViewTypes").WebViewNavigation>) => void;
  48. onLoadingError: (event: NativeSyntheticEvent<WebViewError>) => void;
  49. onLoadingFinish: (event: NativeSyntheticEvent<import("./types/WebViewTypes").WebViewNavigation>) => void;
  50. onMessage: (event: NativeSyntheticEvent<import("./types/WebViewTypes").WebViewMessage>) => void;
  51. onLoadingProgress: (event: NativeSyntheticEvent<WebViewProgressEvent>) => void;
  52. render(): React.ReactNode;
  53. }
  54. export {};