No Description

index.d.ts 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Type definitions for react-native-autoheight-webview 1.x
  2. // Project: https://github.com/iou90/react-native-autoheight-webview
  3. // Definitions by: Naveen Ithappu <https://github.com/naveen-ithappu>
  4. // TypeScript Version: ^3.9.7
  5. import {Component} from 'react';
  6. import {WebViewProps} from 'react-native-webview';
  7. import {StyleProp, ViewStyle} from 'react-native';
  8. export interface StylesFile {
  9. href: string;
  10. type: string;
  11. rel: string;
  12. }
  13. export interface SizeUpdate {
  14. width: number;
  15. height: number;
  16. }
  17. export interface AutoHeightWebViewProps extends WebViewProps {
  18. onSizeUpdated: (size: SizeUpdate) => void;
  19. files: StylesFile[];
  20. style: StyleProp<ViewStyle>;
  21. customScript: string;
  22. customStyle: string;
  23. viewportContent: string;
  24. scalesPageToFit: boolean;
  25. scrollEnabledWithZoomedin: boolean;
  26. }
  27. export default class AutoHeightWebView extends Component<
  28. Partial<AutoHeightWebViewProps>
  29. > {
  30. /**
  31. * Go back one page in the webview's history.
  32. */
  33. goBack: () => void;
  34. /**
  35. * Go forward one page in the webview's history.
  36. */
  37. goForward: () => void;
  38. /**
  39. * Reloads the current page.
  40. */
  41. reload: () => void;
  42. /**
  43. * Stop loading the current page.
  44. */
  45. stopLoading(): void;
  46. /**
  47. * Extra Native Component Config.
  48. */
  49. extraNativeComponentConfig: () => any;
  50. /**
  51. * Executes the JavaScript string.
  52. */
  53. injectJavaScript: (script: string) => void;
  54. /**
  55. * Focuses on WebView redered page.
  56. */
  57. requestFocus: () => void;
  58. /**
  59. * Posts a message to WebView.
  60. */
  61. postMessage: (message: string) => void;
  62. /**
  63. * (Android only)
  64. * Removes the autocomplete popup from the currently focused form field, if present.
  65. */
  66. clearFormData: () => void;
  67. /**
  68. * (Android only)
  69. * Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
  70. */
  71. clearCache: (clear: boolean) => void;
  72. /**
  73. * (Android only)
  74. * Tells this WebView to clear its internal back/forward list.
  75. */
  76. clearHistory: () => void;
  77. }