No Description

WebViewTypes.ts 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. /* eslint-disable react/no-multi-comp, max-classes-per-file */
  2. import { ReactElement, Component } from 'react';
  3. import {
  4. NativeSyntheticEvent,
  5. ViewProps,
  6. NativeMethodsMixin,
  7. Constructor,
  8. UIManagerStatic,
  9. NativeScrollEvent,
  10. } from 'react-native';
  11. export interface WebViewCommands {
  12. goForward: number;
  13. goBack: number;
  14. reload: number;
  15. stopLoading: number;
  16. postMessage: number;
  17. injectJavaScript: number;
  18. loadUrl: number;
  19. requestFocus: number;
  20. }
  21. export interface RNCWebViewUIManager extends UIManagerStatic {
  22. getViewManagerConfig: (
  23. name: 'RNCWebView',
  24. ) => {
  25. Commands: WebViewCommands;
  26. };
  27. }
  28. type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
  29. interface BaseState {
  30. viewState: WebViewState;
  31. }
  32. interface NormalState extends BaseState {
  33. viewState: 'IDLE' | 'LOADING';
  34. lastErrorEvent: WebViewError | null;
  35. }
  36. interface ErrorState extends BaseState {
  37. viewState: 'ERROR';
  38. lastErrorEvent: WebViewError;
  39. }
  40. export type State = NormalState | ErrorState;
  41. // eslint-disable-next-line react/prefer-stateless-function
  42. declare class NativeWebViewIOSComponent extends Component<
  43. IOSNativeWebViewProps
  44. > {}
  45. declare const NativeWebViewIOSBase: Constructor<NativeMethodsMixin> &
  46. typeof NativeWebViewIOSComponent;
  47. export class NativeWebViewIOS extends NativeWebViewIOSBase {}
  48. // eslint-disable-next-line react/prefer-stateless-function
  49. declare class NativeWebViewAndroidComponent extends Component<
  50. AndroidNativeWebViewProps
  51. > {}
  52. declare const NativeWebViewAndroidBase: Constructor<NativeMethodsMixin> &
  53. typeof NativeWebViewAndroidComponent;
  54. export class NativeWebViewAndroid extends NativeWebViewAndroidBase {}
  55. export interface ContentInsetProp {
  56. top?: number;
  57. left?: number;
  58. bottom?: number;
  59. right?: number;
  60. }
  61. export interface WebViewNativeEvent {
  62. url: string;
  63. loading: boolean;
  64. title: string;
  65. canGoBack: boolean;
  66. canGoForward: boolean;
  67. lockIdentifier: number;
  68. }
  69. export interface WebViewNativeProgressEvent extends WebViewNativeEvent {
  70. progress: number;
  71. }
  72. export interface WebViewNavigation extends WebViewNativeEvent {
  73. navigationType:
  74. | 'click'
  75. | 'formsubmit'
  76. | 'backforward'
  77. | 'reload'
  78. | 'formresubmit'
  79. | 'other';
  80. mainDocumentURL?: string;
  81. }
  82. export type DecelerationRateConstant = 'normal' | 'fast';
  83. export interface WebViewMessage extends WebViewNativeEvent {
  84. data: string;
  85. }
  86. export interface WebViewError extends WebViewNativeEvent {
  87. /**
  88. * `domain` is only used on iOS
  89. */
  90. domain?: string;
  91. code: number;
  92. description: string;
  93. }
  94. export interface WebViewHttpError extends WebViewNativeEvent {
  95. description: string;
  96. statusCode: number;
  97. }
  98. export type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
  99. export type WebViewProgressEvent = NativeSyntheticEvent<
  100. WebViewNativeProgressEvent
  101. >;
  102. export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
  103. export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
  104. export type WebViewErrorEvent = NativeSyntheticEvent<WebViewError>;
  105. export type WebViewTerminatedEvent = NativeSyntheticEvent<WebViewNativeEvent>;
  106. export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
  107. export type DataDetectorTypes =
  108. | 'phoneNumber'
  109. | 'link'
  110. | 'address'
  111. | 'calendarEvent'
  112. | 'trackingNumber'
  113. | 'flightNumber'
  114. | 'lookupSuggestion'
  115. | 'none'
  116. | 'all';
  117. export type OverScrollModeType = 'always' | 'content' | 'never';
  118. export interface WebViewSourceUri {
  119. /**
  120. * The URI to load in the `WebView`. Can be a local or remote file.
  121. */
  122. uri: string;
  123. /**
  124. * The HTTP Method to use. Defaults to GET if not specified.
  125. * NOTE: On Android, only GET and POST are supported.
  126. */
  127. method?: string;
  128. /**
  129. * Additional HTTP headers to send with the request.
  130. * NOTE: On Android, this can only be used with GET requests.
  131. */
  132. headers?: Object;
  133. /**
  134. * The HTTP body to send with the request. This must be a valid
  135. * UTF-8 string, and will be sent exactly as specified, with no
  136. * additional encoding (e.g. URL-escaping or base64) applied.
  137. * NOTE: On Android, this can only be used with POST requests.
  138. */
  139. body?: string;
  140. }
  141. export interface WebViewSourceHtml {
  142. /**
  143. * A static HTML page to display in the WebView.
  144. */
  145. html: string;
  146. /**
  147. * The base URL to be used for any relative links in the HTML.
  148. */
  149. baseUrl?: string;
  150. }
  151. export type WebViewSource = WebViewSourceUri | WebViewSourceHtml;
  152. export interface ViewManager {
  153. startLoadWithResult: Function;
  154. }
  155. export interface WebViewNativeConfig {
  156. /**
  157. * The native component used to render the WebView.
  158. */
  159. component?: typeof NativeWebViewIOS | typeof NativeWebViewAndroid;
  160. /**
  161. * Set props directly on the native component WebView. Enables custom props which the
  162. * original WebView doesn't pass through.
  163. */
  164. props?: Object;
  165. /**
  166. * Set the ViewManager to use for communication with the native side.
  167. * @platform ios
  168. */
  169. viewManager?: ViewManager;
  170. }
  171. export type OnShouldStartLoadWithRequest = (
  172. event: WebViewNavigation,
  173. ) => boolean;
  174. export interface CommonNativeWebViewProps extends ViewProps {
  175. cacheEnabled?: boolean;
  176. incognito?: boolean;
  177. injectedJavaScript?: string;
  178. mediaPlaybackRequiresUserAction?: boolean;
  179. messagingEnabled: boolean;
  180. onScroll?: (event: NativeScrollEvent) => void;
  181. onLoadingError: (event: WebViewErrorEvent) => void;
  182. onLoadingFinish: (event: WebViewNavigationEvent) => void;
  183. onLoadingProgress: (event: WebViewProgressEvent) => void;
  184. onLoadingStart: (event: WebViewNavigationEvent) => void;
  185. onHttpError: (event: WebViewHttpErrorEvent) => void;
  186. onMessage: (event: WebViewMessageEvent) => void;
  187. onShouldStartLoadWithRequest: (event: WebViewNavigationEvent) => void;
  188. showsHorizontalScrollIndicator?: boolean;
  189. showsVerticalScrollIndicator?: boolean;
  190. // TODO: find a better way to type this.
  191. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  192. source: any;
  193. userAgent?: string;
  194. /**
  195. * Append to the existing user-agent. Overriden if `userAgent` is set.
  196. */
  197. applicationNameForUserAgent?: string;
  198. }
  199. export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
  200. allowFileAccess?: boolean;
  201. scalesPageToFit?: boolean;
  202. allowUniversalAccessFromFileURLs?: boolean;
  203. androidHardwareAccelerationDisabled?: boolean;
  204. domStorageEnabled?: boolean;
  205. geolocationEnabled?: boolean;
  206. javaScriptEnabled?: boolean;
  207. mixedContentMode?: 'never' | 'always' | 'compatibility';
  208. onContentSizeChange?: (event: WebViewEvent) => void;
  209. overScrollMode?: OverScrollModeType;
  210. saveFormDataDisabled?: boolean;
  211. textZoom?: number;
  212. thirdPartyCookiesEnabled?: boolean;
  213. urlPrefixesForDefaultIntent?: readonly string[];
  214. }
  215. export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
  216. allowingReadAccessToURL?: string;
  217. allowsBackForwardNavigationGestures?: boolean;
  218. allowsInlineMediaPlayback?: boolean;
  219. allowsLinkPreview?: boolean;
  220. automaticallyAdjustContentInsets?: boolean;
  221. bounces?: boolean;
  222. contentInset?: ContentInsetProp;
  223. contentInsetAdjustmentBehavior?:
  224. | 'automatic'
  225. | 'scrollableAxes'
  226. | 'never'
  227. | 'always';
  228. dataDetectorTypes?: DataDetectorTypes | readonly DataDetectorTypes[];
  229. decelerationRate?: number;
  230. directionalLockEnabled?: boolean;
  231. hideKeyboardAccessoryView?: boolean;
  232. pagingEnabled?: boolean;
  233. scrollEnabled?: boolean;
  234. useSharedProcessPool?: boolean;
  235. onContentProcessDidTerminate: (event: WebViewTerminatedEvent) => void;
  236. }
  237. export interface IOSWebViewProps extends WebViewSharedProps {
  238. /**
  239. * Does not store any data within the lifetime of the WebView.
  240. */
  241. incognito?: boolean;
  242. /**
  243. * Boolean value that determines whether the web view bounces
  244. * when it reaches the edge of the content. The default value is `true`.
  245. * @platform ios
  246. */
  247. bounces?: boolean;
  248. /**
  249. * A floating-point number that determines how quickly the scroll view
  250. * decelerates after the user lifts their finger. You may also use the
  251. * string shortcuts `"normal"` and `"fast"` which match the underlying iOS
  252. * settings for `UIScrollViewDecelerationRateNormal` and
  253. * `UIScrollViewDecelerationRateFast` respectively:
  254. *
  255. * - normal: 0.998
  256. * - fast: 0.99 (the default for iOS web view)
  257. * @platform ios
  258. */
  259. decelerationRate?: DecelerationRateConstant | number;
  260. /**
  261. * Boolean value that determines whether scrolling is enabled in the
  262. * `WebView`. The default value is `true`.
  263. * @platform ios
  264. */
  265. scrollEnabled?: boolean;
  266. /**
  267. * If the value of this property is true, the scroll view stops on multiples
  268. * of the scroll view’s bounds when the user scrolls.
  269. * The default value is false.
  270. * @platform ios
  271. */
  272. pagingEnabled?: boolean;
  273. /**
  274. * Controls whether to adjust the content inset for web views that are
  275. * placed behind a navigation bar, tab bar, or toolbar. The default value
  276. * is `true`.
  277. * @platform ios
  278. */
  279. automaticallyAdjustContentInsets?: boolean;
  280. /**
  281. * This property specifies how the safe area insets are used to modify the
  282. * content area of the scroll view. The default value of this property is
  283. * "never". Available on iOS 11 and later.
  284. */
  285. contentInsetAdjustmentBehavior?:
  286. | 'automatic'
  287. | 'scrollableAxes'
  288. | 'never'
  289. | 'always';
  290. /**
  291. * The amount by which the web view content is inset from the edges of
  292. * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
  293. * @platform ios
  294. */
  295. contentInset?: ContentInsetProp;
  296. /**
  297. * Determines the types of data converted to clickable URLs in the web view's content.
  298. * By default only phone numbers are detected.
  299. *
  300. * You can provide one type or an array of many types.
  301. *
  302. * Possible values for `dataDetectorTypes` are:
  303. *
  304. * - `'phoneNumber'`
  305. * - `'link'`
  306. * - `'address'`
  307. * - `'calendarEvent'`
  308. * - `'none'`
  309. * - `'all'`
  310. *
  311. * With the new WebKit implementation, we have three new values:
  312. * - `'trackingNumber'`,
  313. * - `'flightNumber'`,
  314. * - `'lookupSuggestion'`,
  315. *
  316. * @platform ios
  317. */
  318. dataDetectorTypes?: DataDetectorTypes | readonly DataDetectorTypes[];
  319. /**
  320. * Boolean that determines whether HTML5 videos play inline or use the
  321. * native full-screen controller. The default value is `false`.
  322. *
  323. * **NOTE** : In order for video to play inline, not only does this
  324. * property need to be set to `true`, but the video element in the HTML
  325. * document must also include the `webkit-playsinline` attribute.
  326. * @platform ios
  327. */
  328. allowsInlineMediaPlayback?: boolean;
  329. /**
  330. * Hide the accessory view when the keyboard is open. Default is false to be
  331. * backward compatible.
  332. */
  333. hideKeyboardAccessoryView?: boolean;
  334. /**
  335. * A Boolean value indicating whether horizontal swipe gestures will trigger
  336. * back-forward list navigations.
  337. */
  338. allowsBackForwardNavigationGestures?: boolean;
  339. /**
  340. * A Boolean value indicating whether WebKit WebView should be created using a shared
  341. * process pool, enabling WebViews to share cookies and localStorage between each other.
  342. * Default is true but can be set to false for backwards compatibility.
  343. * @platform ios
  344. */
  345. useSharedProcessPool?: boolean;
  346. /**
  347. * The custom user agent string.
  348. */
  349. userAgent?: string;
  350. /**
  351. * A Boolean value that determines whether pressing on a link
  352. * displays a preview of the destination for the link.
  353. *
  354. * This property is available on devices that support 3D Touch.
  355. * In iOS 10 and later, the default value is `true`; before that, the default value is `false`.
  356. * @platform ios
  357. */
  358. allowsLinkPreview?: boolean;
  359. /**
  360. * Set true if shared cookies from HTTPCookieStorage should used for every load request.
  361. * The default value is `false`.
  362. * @platform ios
  363. */
  364. sharedCookiesEnabled?: boolean;
  365. /**
  366. * A Boolean value that determines whether scrolling is disabled in a particular direction.
  367. * The default value is `true`.
  368. * @platform ios
  369. */
  370. directionalLockEnabled?: boolean;
  371. /**
  372. * A Boolean value indicating whether web content can programmatically display the keyboard.
  373. *
  374. * When this property is set to true, the user must explicitly tap the elements in the
  375. * web view to display the keyboard (or other relevant input view) for that element.
  376. * When set to false, a focus event on an element causes the input view to be displayed
  377. * and associated with that element automatically.
  378. *
  379. * The default value is `true`.
  380. * @platform ios
  381. */
  382. keyboardDisplayRequiresUserAction?: boolean;
  383. /**
  384. * A String value that indicates which URLs the WebView's file can then
  385. * reference in scripts, AJAX requests, and CSS imports. This is only used
  386. * for WebViews that are loaded with a source.uri set to a `'file://'` URL.
  387. *
  388. * If not provided, the default is to only allow read access to the URL
  389. * provided in source.uri itself.
  390. * @platform ios
  391. */
  392. allowingReadAccessToURL?: string;
  393. /**
  394. * Function that is invoked when the WebKit WebView content process gets terminated.
  395. * @platform ios
  396. */
  397. onContentProcessDidTerminate: (event: WebViewTerminatedEvent) => void;
  398. }
  399. export interface AndroidWebViewProps extends WebViewSharedProps {
  400. onNavigationStateChange?: (event: WebViewNavigation) => void;
  401. onContentSizeChange?: (event: WebViewEvent) => void;
  402. /**
  403. * https://developer.android.com/reference/android/view/View#OVER_SCROLL_NEVER
  404. * Sets the overScrollMode. Possible values are:
  405. *
  406. * - `'always'` (default)
  407. * - `'content'`
  408. * - `'never'`
  409. *
  410. * @platform android
  411. */
  412. overScrollMode?: OverScrollModeType;
  413. /**
  414. * Boolean that controls whether the web content is scaled to fit
  415. * the view and enables the user to change the scale. The default value
  416. * is `true`.
  417. */
  418. scalesPageToFit?: boolean;
  419. /**
  420. * Sets whether Geolocation is enabled. The default is false.
  421. * @platform android
  422. */
  423. geolocationEnabled?: boolean;
  424. /**
  425. * Boolean that sets whether JavaScript running in the context of a file
  426. * scheme URL should be allowed to access content from any origin.
  427. * Including accessing content from other file scheme URLs
  428. * @platform android
  429. */
  430. allowUniversalAccessFromFileURLs?: boolean;
  431. /**
  432. * Sets whether the webview allow access to file system.
  433. * @platform android
  434. */
  435. allowFileAccess?: boolean;
  436. /**
  437. * Used on Android only, controls whether form autocomplete data should be saved
  438. * @platform android
  439. */
  440. saveFormDataDisabled?: boolean;
  441. /**
  442. * Used on Android only, controls whether the given list of URL prefixes should
  443. * make {@link com.facebook.react.views.webview.ReactWebViewClient} to launch a
  444. * default activity intent for those URL instead of loading it within the webview.
  445. * Use this to list URLs that WebView cannot handle, e.g. a PDF url.
  446. * @platform android
  447. */
  448. urlPrefixesForDefaultIntent?: readonly string[];
  449. /**
  450. * Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
  451. * as Hardware Acceleration is a feature only for Android. The default value is `false`.
  452. * @platform android
  453. */
  454. androidHardwareAccelerationDisabled?: boolean;
  455. /**
  456. * Boolean value to enable third party cookies in the `WebView`. Used on
  457. * Android Lollipop and above only as third party cookies are enabled by
  458. * default on Android Kitkat and below and on iOS. The default value is `true`.
  459. * @platform android
  460. */
  461. thirdPartyCookiesEnabled?: boolean;
  462. /**
  463. * Boolean value to control whether DOM Storage is enabled. Used only in
  464. * Android.
  465. * @platform android
  466. */
  467. domStorageEnabled?: boolean;
  468. /**
  469. * Sets the user-agent for the `WebView`.
  470. * @platform android
  471. */
  472. userAgent?: string;
  473. /**
  474. * Sets number that controls text zoom of the page in percent.
  475. * @platform android
  476. */
  477. textZoom?: number;
  478. /**
  479. * Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
  480. *
  481. * Possible values for `mixedContentMode` are:
  482. *
  483. * - `'never'` (default) - WebView will not allow a secure origin to load content from an insecure origin.
  484. * - `'always'` - WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
  485. * - `'compatibility'` - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
  486. * @platform android
  487. */
  488. mixedContentMode?: 'never' | 'always' | 'compatibility';
  489. /**
  490. * Sets ability to open fullscreen videos on Android devices.
  491. */
  492. allowsFullscreenVideo?: boolean;
  493. }
  494. export interface WebViewSharedProps extends ViewProps {
  495. /**
  496. * Loads static html or a uri (with optional headers) in the WebView.
  497. */
  498. source?: WebViewSource;
  499. /**
  500. * Boolean value to enable JavaScript in the `WebView`. Used on Android only
  501. * as JavaScript is enabled by default on iOS. The default value is `true`.
  502. * @platform android
  503. */
  504. javaScriptEnabled?: boolean;
  505. /**
  506. * Function that returns a view to show if there's an error.
  507. */
  508. renderError?: (
  509. errorDomain: string | undefined,
  510. errorCode: number,
  511. errorDesc: string,
  512. ) => ReactElement; // view to show if there's an error
  513. /**
  514. * Function that returns a loading indicator.
  515. */
  516. renderLoading?: () => ReactElement;
  517. /**
  518. * Function that is invoked when the `WebView` scrolls.
  519. */
  520. onScroll?: (event: NativeScrollEvent) => void;
  521. /**
  522. * Function that is invoked when the `WebView` has finished loading.
  523. */
  524. onLoad?: (event: WebViewNavigationEvent) => void;
  525. /**
  526. * Function that is invoked when the `WebView` load succeeds or fails.
  527. */
  528. onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
  529. /**
  530. * Function that is invoked when the `WebView` starts loading.
  531. */
  532. onLoadStart?: (event: WebViewNavigationEvent) => void;
  533. /**
  534. * Function that is invoked when the `WebView` load fails.
  535. */
  536. onError?: (event: WebViewErrorEvent) => void;
  537. /**
  538. * Function that is invoked when the `WebView` receives an error status code.
  539. * Works on iOS and Android (minimum API level 23).
  540. */
  541. onHttpError?: (event: WebViewHttpErrorEvent) => void;
  542. /**
  543. * Function that is invoked when the `WebView` loading starts or ends.
  544. */
  545. onNavigationStateChange?: (event: WebViewNavigation) => void;
  546. /**
  547. * Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`.
  548. * Setting this property will inject this global into your webview.
  549. *
  550. * `window.ReactNativeWebView.postMessage` accepts one argument, `data`, which will be
  551. * available on the event object, `event.nativeEvent.data`. `data` must be a string.
  552. */
  553. onMessage?: (event: WebViewMessageEvent) => void;
  554. /**
  555. * Function that is invoked when the `WebView` is loading.
  556. */
  557. onLoadProgress?: (event: WebViewProgressEvent) => void;
  558. /**
  559. * Boolean value that forces the `WebView` to show the loading view
  560. * on the first load.
  561. */
  562. startInLoadingState?: boolean;
  563. /**
  564. * Set this to provide JavaScript that will be injected into the web page
  565. * when the view loads.
  566. */
  567. injectedJavaScript?: string;
  568. /**
  569. * Boolean value that determines whether a horizontal scroll indicator is
  570. * shown in the `WebView`. The default value is `true`.
  571. */
  572. showsHorizontalScrollIndicator?: boolean;
  573. /**
  574. * Boolean value that determines whether a vertical scroll indicator is
  575. * shown in the `WebView`. The default value is `true`.
  576. */
  577. showsVerticalScrollIndicator?: boolean;
  578. /**
  579. * Boolean that determines whether HTML5 audio and video requires the user
  580. * to tap them before they start playing. The default value is `true`.
  581. */
  582. mediaPlaybackRequiresUserAction?: boolean;
  583. /**
  584. * List of origin strings to allow being navigated to. The strings allow
  585. * wildcards and get matched against *just* the origin (not the full URL).
  586. * If the user taps to navigate to a new page but the new page is not in
  587. * this whitelist, we will open the URL in Safari.
  588. * The default whitelisted origins are "http://*" and "https://*".
  589. */
  590. originWhitelist?: readonly string[];
  591. /**
  592. * Function that allows custom handling of any web view requests. Return
  593. * `true` from the function to continue loading the request and `false`
  594. * to stop loading. The `navigationType` is always `other` on android.
  595. */
  596. onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest;
  597. /**
  598. * Override the native component used to render the WebView. Enables a custom native
  599. * WebView which uses the same JavaScript as the original WebView.
  600. */
  601. nativeConfig?: WebViewNativeConfig;
  602. /**
  603. * Should caching be enabled. Default is true.
  604. */
  605. cacheEnabled?: boolean;
  606. }