@exodus/react-native-webview 11.26.1-exodus.8 → 13.16.0-exodus.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +36 -63
  2. package/android/build.gradle +83 -110
  3. package/android/gradle.properties +3 -4
  4. package/android/src/main/AndroidManifest.xml +12 -0
  5. package/android/src/main/AndroidManifestNew.xml +26 -0
  6. package/android/src/main/java/com/reactnativecommunity/webview/RNCBasicAuthCredential.java +11 -0
  7. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +407 -0
  8. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +468 -0
  9. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +330 -0
  10. package/android/src/main/java/com/reactnativecommunity/webview/{WebViewConfig.java → RNCWebViewConfig.java} +3 -4
  11. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewFileProvider.java +1 -1
  12. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +746 -0
  13. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewMessagingModule.kt +9 -0
  14. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModuleImpl.java +554 -0
  15. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.java +57 -12
  16. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewWrapper.kt +39 -0
  17. package/android/src/main/java/com/reactnativecommunity/webview/events/SubResourceErrorEvent.kt +25 -0
  18. package/android/src/main/java/com/reactnativecommunity/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
  19. package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +25 -0
  20. package/android/src/main/java/com/reactnativecommunity/webview/events/TopNewWindowEvent.kt +25 -0
  21. package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt +25 -0
  22. package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +570 -0
  23. package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewModule.java +57 -0
  24. package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +341 -0
  25. package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewModule.java +59 -0
  26. package/apple/RCTConvert+WKDataDetectorTypes.h +11 -0
  27. package/apple/RCTConvert+WKDataDetectorTypes.m +27 -0
  28. package/apple/RNCWebView.h +26 -100
  29. package/apple/RNCWebView.mm +555 -0
  30. package/apple/RNCWebViewDecisionManager.h +20 -0
  31. package/apple/RNCWebViewDecisionManager.m +47 -0
  32. package/apple/RNCWebViewImpl.h +164 -0
  33. package/apple/{RNCWebView.m → RNCWebViewImpl.m} +803 -226
  34. package/apple/RNCWebViewManager.h +4 -8
  35. package/apple/RNCWebViewManager.mm +221 -0
  36. package/apple/RNCWebViewModule.h +23 -0
  37. package/apple/RNCWebViewModule.mm +34 -0
  38. package/index.d.ts +2 -3
  39. package/lib/NativeRNCWebViewModule.d.ts +8 -0
  40. package/lib/NativeRNCWebViewModule.js +1 -0
  41. package/lib/RNCWebViewNativeComponent.d.ts +245 -0
  42. package/lib/RNCWebViewNativeComponent.js +1 -0
  43. package/lib/WebView.android.d.ts +0 -1
  44. package/lib/WebView.android.js +1 -135
  45. package/lib/WebView.d.ts +2 -3
  46. package/lib/WebView.ios.d.ts +0 -1
  47. package/lib/WebView.ios.js +1 -114
  48. package/lib/WebView.js +1 -11
  49. package/lib/WebView.macos.d.ts +6 -0
  50. package/lib/WebView.macos.js +1 -0
  51. package/lib/WebView.styles.d.ts +37 -11
  52. package/lib/WebView.styles.js +1 -33
  53. package/lib/WebView.windows.d.ts +17 -0
  54. package/lib/WebView.windows.js +1 -0
  55. package/lib/WebViewNativeComponent.macos.d.ts +3 -0
  56. package/lib/WebViewNativeComponent.macos.js +1 -0
  57. package/lib/WebViewNativeComponent.windows.d.ts +3 -0
  58. package/lib/WebViewNativeComponent.windows.js +1 -0
  59. package/lib/WebViewShared.d.ts +30 -9
  60. package/lib/WebViewShared.js +1 -174
  61. package/lib/WebViewTypes.d.ts +514 -98
  62. package/lib/WebViewTypes.js +1 -6
  63. package/lib/index.d.ts +0 -1
  64. package/lib/index.js +1 -3
  65. package/lib/validation.d.ts +3 -0
  66. package/lib/validation.js +1 -0
  67. package/package.json +57 -33
  68. package/react-native-webview.podspec +32 -5
  69. package/react-native.config.js +22 -18
  70. package/src/NativeRNCWebViewModule.ts +13 -0
  71. package/src/RNCWebViewNativeComponent.ts +348 -0
  72. package/src/WebView.android.tsx +345 -0
  73. package/src/WebView.ios.tsx +341 -0
  74. package/src/WebView.macos.tsx +252 -0
  75. package/src/WebView.styles.ts +41 -0
  76. package/src/WebView.tsx +25 -0
  77. package/src/WebView.windows.tsx +217 -0
  78. package/src/WebViewNativeComponent.macos.ts +7 -0
  79. package/src/WebViewNativeComponent.windows.ts +8 -0
  80. package/src/WebViewShared.tsx +476 -0
  81. package/src/WebViewTypes.ts +1402 -0
  82. package/src/__tests__/WebViewShared-test.js +323 -0
  83. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
  84. package/src/__tests__/validation-test.js +38 -0
  85. package/src/index.ts +4 -0
  86. package/src/validation.ts +20 -0
  87. package/android/.editorconfig +0 -6
  88. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  89. package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  90. package/android/.gradle/7.4.2/dependencies-accessors/gc.properties +0 -0
  91. package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
  92. package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
  93. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  94. package/android/.gradle/7.4.2/gc.properties +0 -0
  95. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  96. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  97. package/android/.gradle/vcs-1/gc.properties +0 -0
  98. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -1408
  99. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java +0 -506
  100. package/apple/RNCWebViewManager.m +0 -278
  101. package/ios/Pods/Manifest.lock +0 -3
  102. package/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -397
  103. package/ios/Pods/Pods.xcodeproj/xcuserdata/gabrielezenwankwo.xcuserdatad/xcschemes/Pods-RNCWebView.xcscheme +0 -58
  104. package/ios/Pods/Pods.xcodeproj/xcuserdata/gabrielezenwankwo.xcuserdatad/xcschemes/xcschememanagement.plist +0 -16
  105. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView-Info.plist +0 -26
  106. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView-acknowledgements.markdown +0 -3
  107. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView-acknowledgements.plist +0 -29
  108. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView-dummy.m +0 -5
  109. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView-umbrella.h +0 -16
  110. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView.debug.xcconfig +0 -8
  111. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView.modulemap +0 -6
  112. package/ios/Pods/Target Support Files/Pods-RNCWebView/Pods-RNCWebView.release.xcconfig +0 -8
  113. package/lib/UpdateOS.d.ts +0 -6
  114. package/lib/UpdateOS.js +0 -49
  115. package/lib/WebViewNativeComponent.android.d.ts +0 -4
  116. package/lib/WebViewNativeComponent.android.js +0 -3
  117. package/lib/WebViewNativeComponent.ios.d.ts +0 -4
  118. package/lib/WebViewNativeComponent.ios.js +0 -3
@@ -0,0 +1,1402 @@
1
+ import { ReactElement, Component, ComponentProps, ElementType } from 'react';
2
+ import {
3
+ NativeSyntheticEvent,
4
+ ViewProps,
5
+ StyleProp,
6
+ ViewStyle,
7
+ NativeMethodsMixin,
8
+ UIManagerStatic,
9
+ NativeScrollEvent,
10
+ } from 'react-native';
11
+
12
+ import type NativeWebViewComponent from './RNCWebViewNativeComponent';
13
+
14
+ type WebViewCommands =
15
+ | 'goForward'
16
+ | 'goBack'
17
+ | 'reload'
18
+ | 'stopLoading'
19
+ | 'postMessage'
20
+ | 'injectJavaScript'
21
+ | 'loadUrl'
22
+ | 'requestFocus'
23
+ | 'clearCache';
24
+
25
+ type AndroidWebViewCommands = 'clearHistory' | 'clearFormData';
26
+
27
+ interface RNCWebViewUIManager<Commands extends string> extends UIManagerStatic {
28
+ getViewManagerConfig: (name: string) => {
29
+ Commands: { [key in Commands]: number };
30
+ };
31
+ }
32
+
33
+ export type RNCWebViewUIManagerAndroid = RNCWebViewUIManager<
34
+ WebViewCommands | AndroidWebViewCommands
35
+ >;
36
+ export type RNCWebViewUIManagerIOS = RNCWebViewUIManager<WebViewCommands>;
37
+ export type RNCWebViewUIManagerMacOS = RNCWebViewUIManager<WebViewCommands>;
38
+ export type RNCWebViewUIManagerWindows = RNCWebViewUIManager<WebViewCommands>;
39
+
40
+ type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
41
+
42
+ interface BaseState {
43
+ viewState: WebViewState;
44
+ }
45
+
46
+ interface NormalState extends BaseState {
47
+ viewState: 'IDLE' | 'LOADING';
48
+ lastErrorEvent: WebViewError | null;
49
+ }
50
+
51
+ interface ErrorState extends BaseState {
52
+ viewState: 'ERROR';
53
+ lastErrorEvent: WebViewError;
54
+ }
55
+
56
+ export type State = NormalState | ErrorState;
57
+
58
+ type Constructor<T> = new (...args: any[]) => T;
59
+
60
+ declare class NativeWebViewMacOSComponent extends Component<MacOSNativeWebViewProps> {}
61
+ declare const NativeWebViewMacOSBase: Constructor<NativeMethodsMixin> &
62
+ typeof NativeWebViewMacOSComponent;
63
+ export class NativeWebViewMacOS extends NativeWebViewMacOSBase {}
64
+
65
+ declare class NativeWebViewWindowsComponent extends Component<WindowsNativeWebViewProps> {}
66
+ declare const NativeWebViewWindowsBase: Constructor<NativeMethodsMixin> &
67
+ typeof NativeWebViewWindowsComponent;
68
+ export class NativeWebViewWindows extends NativeWebViewWindowsBase {}
69
+
70
+ export interface ContentInsetProp {
71
+ top?: number;
72
+ left?: number;
73
+ bottom?: number;
74
+ right?: number;
75
+ }
76
+
77
+ export interface WebViewNativeEvent {
78
+ url: string;
79
+ loading: boolean;
80
+ title: string;
81
+ canGoBack: boolean;
82
+ canGoForward: boolean;
83
+ lockIdentifier: number;
84
+ }
85
+
86
+ export interface WebViewNativeProgressEvent extends WebViewNativeEvent {
87
+ progress: number;
88
+ }
89
+
90
+ export interface WebViewNavigation extends WebViewNativeEvent {
91
+ navigationType:
92
+ | 'click'
93
+ | 'formsubmit'
94
+ | 'backforward'
95
+ | 'reload'
96
+ | 'formresubmit'
97
+ | 'other';
98
+ mainDocumentURL?: string;
99
+ }
100
+
101
+ export interface ShouldStartLoadRequest extends WebViewNavigation {
102
+ isTopFrame: boolean;
103
+ }
104
+
105
+ export interface FileDownload {
106
+ downloadUrl: string;
107
+ }
108
+
109
+ export type DecelerationRateConstant = 'normal' | 'fast';
110
+
111
+ export interface WebViewMessage extends WebViewNativeEvent {
112
+ data: string;
113
+ }
114
+
115
+ export interface WebViewError extends WebViewNativeEvent {
116
+ /**
117
+ * `domain` is only used on iOS and macOS
118
+ */
119
+ domain?: string;
120
+ code: number;
121
+ description: string;
122
+ }
123
+
124
+ export interface WebViewHttpError extends WebViewNativeEvent {
125
+ description: string;
126
+ statusCode: number;
127
+ }
128
+
129
+ export interface WebViewRenderProcessGoneDetail {
130
+ didCrash: boolean;
131
+ }
132
+
133
+ export interface WebViewOpenWindow {
134
+ targetUrl: string;
135
+ }
136
+
137
+ export type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
138
+
139
+ export type WebViewProgressEvent =
140
+ NativeSyntheticEvent<WebViewNativeProgressEvent>;
141
+
142
+ export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
143
+
144
+ export type ShouldStartLoadRequestEvent =
145
+ NativeSyntheticEvent<ShouldStartLoadRequest>;
146
+
147
+ export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
148
+
149
+ export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
150
+
151
+ export type WebViewErrorEvent = NativeSyntheticEvent<WebViewError>;
152
+
153
+ export type WebViewTerminatedEvent = NativeSyntheticEvent<WebViewNativeEvent>;
154
+
155
+ export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
156
+
157
+ export type WebViewRenderProcessGoneEvent =
158
+ NativeSyntheticEvent<WebViewRenderProcessGoneDetail>;
159
+
160
+ export type WebViewOpenWindowEvent = NativeSyntheticEvent<WebViewOpenWindow>;
161
+
162
+ export type WebViewScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
163
+
164
+ export type DataDetectorTypes =
165
+ | 'phoneNumber'
166
+ | 'link'
167
+ | 'address'
168
+ | 'calendarEvent'
169
+ | 'trackingNumber'
170
+ | 'flightNumber'
171
+ | 'lookupSuggestion'
172
+ | 'none'
173
+ | 'all';
174
+
175
+ export type OverScrollModeType = 'always' | 'content' | 'never';
176
+
177
+ export type CacheMode =
178
+ | 'LOAD_DEFAULT'
179
+ | 'LOAD_CACHE_ONLY'
180
+ | 'LOAD_CACHE_ELSE_NETWORK'
181
+ | 'LOAD_NO_CACHE';
182
+
183
+ export type AndroidLayerType = 'none' | 'software' | 'hardware';
184
+
185
+ export type IndicatorStyleType = 'default' | 'black' | 'white';
186
+
187
+ export interface WebViewSourceUri {
188
+ /**
189
+ * The URI to load in the `WebView`. Can be a local or remote file.
190
+ */
191
+ uri: string;
192
+
193
+ /**
194
+ * The HTTP Method to use. Defaults to GET if not specified.
195
+ * NOTE: On Android, only GET and POST are supported.
196
+ */
197
+ method?: string;
198
+
199
+ /**
200
+ * Additional HTTP headers to send with the request.
201
+ * NOTE: On Android, this can only be used with GET requests.
202
+ */
203
+ headers?: Object;
204
+
205
+ /**
206
+ * The HTTP body to send with the request. This must be a valid
207
+ * UTF-8 string, and will be sent exactly as specified, with no
208
+ * additional encoding (e.g. URL-escaping or base64) applied.
209
+ * NOTE: On Android, this can only be used with POST requests.
210
+ */
211
+ body?: string;
212
+ }
213
+
214
+ export interface WebViewSourceHtml {
215
+ /**
216
+ * A static HTML page to display in the WebView.
217
+ */
218
+ html: string;
219
+ /**
220
+ * The base URL to be used for any relative links in the HTML.
221
+ */
222
+ baseUrl?: string;
223
+ }
224
+
225
+ export interface WebViewCustomMenuItems {
226
+ /**
227
+ * The unique key that will be added as a selector on the webview
228
+ * Returned by the `onCustomMenuSelection` callback
229
+ */
230
+ key: string;
231
+ /**
232
+ * The label to appear on the UI Menu when selecting text
233
+ */
234
+ label: string;
235
+ }
236
+
237
+ export declare type SuppressMenuItem =
238
+ | 'cut'
239
+ | 'copy'
240
+ | 'paste'
241
+ | 'replace'
242
+ | 'bold'
243
+ | 'italic'
244
+ | 'underline'
245
+ | 'select'
246
+ | 'selectAll'
247
+ | 'translate'
248
+ | 'lookup'
249
+ | 'share';
250
+
251
+ export type WebViewSource = WebViewSourceUri | WebViewSourceHtml;
252
+
253
+ export interface ViewManager {
254
+ shouldStartLoadWithLockIdentifier: Function;
255
+ }
256
+
257
+ export interface WebViewNativeConfig {
258
+ /**
259
+ * The native component used to render the WebView.
260
+ */
261
+ component?: typeof NativeWebViewMacOS | typeof NativeWebViewComponent;
262
+ /**
263
+ * Set props directly on the native component WebView. Enables custom props which the
264
+ * original WebView doesn't pass through.
265
+ */
266
+ props?: Object;
267
+ /**
268
+ * Set the ViewManager to use for communication with the native side.
269
+ * @platform ios, macos
270
+ */
271
+ viewManager?: ViewManager;
272
+ }
273
+
274
+ export type OnShouldStartLoadWithRequest = (
275
+ event: ShouldStartLoadRequest
276
+ ) => boolean;
277
+
278
+ export interface BasicAuthCredential {
279
+ /**
280
+ * A username used for basic authentication.
281
+ */
282
+ username: string;
283
+
284
+ /**
285
+ * A password used for basic authentication.
286
+ */
287
+ password: string;
288
+ }
289
+
290
+ export interface CommonNativeWebViewProps extends ViewProps {
291
+ cacheEnabled?: boolean;
292
+ incognito?: boolean;
293
+ injectedJavaScript?: string;
294
+ injectedJavaScriptBeforeContentLoaded?: string;
295
+ injectedJavaScriptForMainFrameOnly?: boolean;
296
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
297
+ javaScriptCanOpenWindowsAutomatically?: boolean;
298
+ mediaPlaybackRequiresUserAction?: boolean;
299
+ webviewDebuggingEnabled?: boolean;
300
+ messagingEnabled: boolean;
301
+ /**
302
+ * Exodus: List of origins allowed to request camera/microphone permissions.
303
+ * Only URLs from these origins will be allowed to access camera/microphone.
304
+ */
305
+ cameraPermissionOriginWhitelist?: readonly string[];
306
+ onScroll?: (event: WebViewScrollEvent) => void;
307
+ onLoadingError: (event: WebViewErrorEvent) => void;
308
+ onLoadingFinish: (event: WebViewNavigationEvent) => void;
309
+ onLoadingProgress: (event: WebViewProgressEvent) => void;
310
+ onLoadingStart: (event: WebViewNavigationEvent) => void;
311
+ onHttpError: (event: WebViewHttpErrorEvent) => void;
312
+ onMessage: (event: WebViewMessageEvent) => void;
313
+ onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
314
+ showsHorizontalScrollIndicator?: boolean;
315
+ showsVerticalScrollIndicator?: boolean;
316
+ paymentRequestEnabled?: boolean;
317
+ // TODO: find a better way to type this.
318
+
319
+ source: any;
320
+ userAgent?: string;
321
+ /**
322
+ * Append to the existing user-agent. Overridden if `userAgent` is set.
323
+ */
324
+ applicationNameForUserAgent?: string;
325
+ basicAuthCredential?: BasicAuthCredential;
326
+ }
327
+
328
+ export declare type ContentInsetAdjustmentBehavior =
329
+ | 'automatic'
330
+ | 'scrollableAxes'
331
+ | 'never'
332
+ | 'always';
333
+
334
+ export declare type MediaCapturePermissionGrantType =
335
+ | 'grantIfSameHostElsePrompt'
336
+ | 'grantIfSameHostElseDeny'
337
+ | 'deny'
338
+ | 'grant'
339
+ | 'prompt';
340
+
341
+ export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
342
+
343
+ export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
344
+ allowingReadAccessToURL?: string;
345
+ allowFileAccessFromFileURLs?: boolean;
346
+ allowUniversalAccessFromFileURLs?: boolean;
347
+ allowsBackForwardNavigationGestures?: boolean;
348
+ allowsInlineMediaPlayback?: boolean;
349
+ allowsPictureInPictureMediaPlayback?: boolean;
350
+ allowsAirPlayForMediaPlayback?: boolean;
351
+ allowsLinkPreview?: boolean;
352
+ automaticallyAdjustContentInsets?: boolean;
353
+ bounces?: boolean;
354
+ contentInset?: ContentInsetProp;
355
+ contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
356
+ directionalLockEnabled?: boolean;
357
+ hideKeyboardAccessoryView?: boolean;
358
+ javaScriptEnabled?: boolean;
359
+ pagingEnabled?: boolean;
360
+ scrollEnabled?: boolean;
361
+ useSharedProcessPool?: boolean;
362
+ onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
363
+ }
364
+
365
+ export interface WindowsNativeWebViewProps extends CommonNativeWebViewProps {
366
+ testID?: string;
367
+ linkHandlingEnabled?: boolean;
368
+ onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
369
+ onSourceChanged?: (event: WebViewNavigationEvent) => void;
370
+ }
371
+
372
+ export interface WindowsWebViewProps extends WebViewSharedProps {
373
+ /**
374
+ * Boolean value that detenmines whether the web view should use the new chromium based edge webview.
375
+ */
376
+ useWebView2?: boolean;
377
+ /**
378
+ * Function that is invoked when the `WebView` should open a new window.
379
+ *
380
+ * This happens when the JS calls `window.open('http://someurl', '_blank')`
381
+ * or when the user clicks on a `<a href="http://someurl" target="_blank">` link.
382
+ *
383
+ * Only works with `useWebView2` set to `true`.
384
+ *
385
+ * @platform windows
386
+ */
387
+ onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
388
+
389
+ /**
390
+ * Function that is invoked when the `WebView` responds to a request to load a new resource.
391
+ * Works only on Windows.
392
+ *
393
+ * Only works with `useWebView2` set to `true`.
394
+ *
395
+ * @platform windows
396
+ */
397
+ onSourceChanged?: (event: WebViewNavigationEvent) => void;
398
+ }
399
+
400
+ export interface IOSWebViewProps extends WebViewSharedProps {
401
+ /**
402
+ * Does not store any data within the lifetime of the WebView.
403
+ */
404
+ incognito?: boolean;
405
+
406
+ /**
407
+ * Boolean value that determines whether the web view bounces
408
+ * when it reaches the edge of the content. The default value is `true`.
409
+ * @platform ios
410
+ */
411
+ bounces?: boolean;
412
+
413
+ /**
414
+ * A floating-point number that determines how quickly the scroll view
415
+ * decelerates after the user lifts their finger. You may also use the
416
+ * string shortcuts `"normal"` and `"fast"` which match the underlying iOS
417
+ * settings for `UIScrollViewDecelerationRateNormal` and
418
+ * `UIScrollViewDecelerationRateFast` respectively:
419
+ *
420
+ * - normal: 0.998
421
+ * - fast: 0.99 (the default for iOS web view)
422
+ * @platform ios
423
+ */
424
+ decelerationRate?: DecelerationRateConstant | number;
425
+
426
+ /**
427
+ * Boolean value that determines whether scrolling is enabled in the
428
+ * `WebView`. The default value is `true`.
429
+ * @platform ios
430
+ */
431
+ scrollEnabled?: boolean;
432
+
433
+ /**
434
+ * If the value of this property is true, the scroll view stops on multiples
435
+ * of the scroll view's bounds when the user scrolls.
436
+ * The default value is false.
437
+ * @platform ios
438
+ */
439
+ pagingEnabled?: boolean;
440
+
441
+ /**
442
+ * Controls whether to adjust the content inset for web views that are
443
+ * placed behind a navigation bar, tab bar, or toolbar. The default value
444
+ * is `true`.
445
+ * @platform ios
446
+ */
447
+ automaticallyAdjustContentInsets?: boolean;
448
+
449
+ /**
450
+ * Controls whether to adjust the scroll indicator inset for web views that are
451
+ * placed behind a navigation bar, tab bar, or toolbar. The default value
452
+ * is `false`. (iOS 13+)
453
+ * @platform ios
454
+ */
455
+ automaticallyAdjustsScrollIndicatorInsets?: boolean;
456
+
457
+ /**
458
+ * This property specifies how the safe area insets are used to modify the
459
+ * content area of the scroll view. The default value of this property is
460
+ * "never". Available on iOS 11 and later.
461
+ */
462
+ contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
463
+
464
+ /**
465
+ * The amount by which the web view content is inset from the edges of
466
+ * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
467
+ * @platform ios
468
+ */
469
+ contentInset?: ContentInsetProp;
470
+
471
+ /**
472
+ * Defaults to `recommended`, which loads mobile content on iPhone
473
+ * and iPad Mini but desktop content on other iPads.
474
+ *
475
+ * Possible values are:
476
+ * - `'recommended'`
477
+ * - `'mobile'`
478
+ * - `'desktop'`
479
+ * @platform ios
480
+ */
481
+ contentMode?: ContentMode;
482
+
483
+ /**
484
+ * Determines the types of data converted to clickable URLs in the web view's content.
485
+ * By default only phone numbers are detected.
486
+ *
487
+ * You can provide one type or an array of many types.
488
+ *
489
+ * Possible values for `dataDetectorTypes` are:
490
+ *
491
+ * - `'phoneNumber'`
492
+ * - `'link'`
493
+ * - `'address'`
494
+ * - `'calendarEvent'`
495
+ * - `'none'`
496
+ * - `'all'`
497
+ *
498
+ * With the new WebKit implementation, we have three new values:
499
+ * - `'trackingNumber'`,
500
+ * - `'flightNumber'`,
501
+ * - `'lookupSuggestion'`,
502
+ *
503
+ * @platform ios
504
+ */
505
+ readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
506
+
507
+ /**
508
+ * Boolean that determines whether HTML5 videos play inline or use the
509
+ * native full-screen controller. The default value is `false`.
510
+ *
511
+ * **NOTE** : In order for video to play inline, not only does this
512
+ * property need to be set to `true`, but the video element in the HTML
513
+ * document must also include the `webkit-playsinline` attribute.
514
+ * @platform ios
515
+ */
516
+ allowsInlineMediaPlayback?: boolean;
517
+ /**
518
+ * Boolean value that indicates whether HTML5 videos can play Picture in Picture.
519
+ * The default value is `true`.
520
+ *
521
+ * @platform macos
522
+ */
523
+ allowsPictureInPictureMediaPlayback?: boolean;
524
+ /**
525
+ * A Boolean value indicating whether AirPlay is allowed. The default value is `false`.
526
+ * @platform ios
527
+ */
528
+ allowsAirPlayForMediaPlayback?: boolean;
529
+ /**
530
+ * Hide the accessory view when the keyboard is open. Default is false to be
531
+ * backward compatible.
532
+ */
533
+ hideKeyboardAccessoryView?: boolean;
534
+ /**
535
+ * A Boolean value indicating whether horizontal swipe gestures will trigger
536
+ * back-forward list navigations.
537
+ */
538
+ allowsBackForwardNavigationGestures?: boolean;
539
+ /**
540
+ * A Boolean value indicating whether WebKit WebView should be created using a shared
541
+ * process pool, enabling WebViews to share cookies and localStorage between each other.
542
+ * Default is true but can be set to false for backwards compatibility.
543
+ * @platform ios
544
+ */
545
+ useSharedProcessPool?: boolean;
546
+
547
+ /**
548
+ * The custom user agent string.
549
+ * @platform ios
550
+ */
551
+ userAgent?: string;
552
+
553
+ /**
554
+ * A Boolean value that determines whether pressing on a link
555
+ * displays a preview of the destination for the link.
556
+ *
557
+ * This property is available on devices that support 3D Touch.
558
+ * In iOS 10 and later, the default value is `true`; before that, the default value is `false`.
559
+ * @platform ios
560
+ */
561
+ allowsLinkPreview?: boolean;
562
+
563
+ /**
564
+ * Set true if shared cookies from HTTPCookieStorage should used for every load request.
565
+ * The default value is `false`.
566
+ * @platform ios
567
+ */
568
+ sharedCookiesEnabled?: boolean;
569
+
570
+ /**
571
+ * When set to true the hardware silent switch is ignored.
572
+ * The default value is `false`.
573
+ * @platform ios
574
+ */
575
+ ignoreSilentHardwareSwitch?: boolean;
576
+
577
+ /**
578
+ * Set true if StatusBar should be light when user watch video fullscreen.
579
+ * The default value is `true`.
580
+ * @platform ios
581
+ */
582
+ autoManageStatusBarEnabled?: boolean;
583
+
584
+ /**
585
+ * A Boolean value that determines whether scrolling is disabled in a particular direction.
586
+ * The default value is `true`.
587
+ * @platform ios
588
+ */
589
+ directionalLockEnabled?: boolean;
590
+
591
+ /**
592
+ * A Boolean value indicating whether web content can programmatically display the keyboard.
593
+ *
594
+ * When this property is set to true, the user must explicitly tap the elements in the
595
+ * web view to display the keyboard (or other relevant input view) for that element.
596
+ * When set to false, a focus event on an element causes the input view to be displayed
597
+ * and associated with that element automatically.
598
+ *
599
+ * The default value is `true`.
600
+ * @platform ios
601
+ */
602
+ keyboardDisplayRequiresUserAction?: boolean;
603
+
604
+ /**
605
+ * A String value that indicates which URLs the WebView's file can then
606
+ * reference in scripts, AJAX requests, and CSS imports. This is only used
607
+ * for WebViews that are loaded with a source.uri set to a `'file://'` URL.
608
+ *
609
+ * If not provided, the default is to only allow read access to the URL
610
+ * provided in source.uri itself.
611
+ * @platform ios
612
+ */
613
+ allowingReadAccessToURL?: string;
614
+
615
+ /**
616
+ * Boolean that sets whether JavaScript running in the context of a file
617
+ * scheme URL should be allowed to access content from other file scheme URLs.
618
+ * Including accessing content from other file scheme URLs
619
+ * @platform ios
620
+ */
621
+ allowFileAccessFromFileURLs?: boolean;
622
+
623
+ /**
624
+ * Boolean that sets whether JavaScript running in the context of a file
625
+ * scheme URL should be allowed to access content from any origin.
626
+ * Including accessing content from other file scheme URLs
627
+ * @platform ios
628
+ */
629
+ allowUniversalAccessFromFileURLs?: boolean;
630
+
631
+ /**
632
+ * Function that is invoked when the WebKit WebView content process gets terminated.
633
+ * @platform ios
634
+ */
635
+ onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
636
+
637
+ /**
638
+ * Function that is invoked when the `WebView` should open a new window.
639
+ *
640
+ * This happens when the JS calls `window.open('http://someurl', '_blank')`
641
+ * or when the user clicks on a `<a href="http://someurl" target="_blank">` link.
642
+ *
643
+ * @platform ios
644
+ */
645
+ onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
646
+
647
+ /**
648
+ * If `true` (default), loads the `injectedJavaScript` only into the main frame.
649
+ * If `false`, loads it into all frames (e.g. iframes).
650
+ * @platform ios
651
+ */
652
+ injectedJavaScriptForMainFrameOnly?: boolean;
653
+
654
+ /**
655
+ * If `true` (default), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
656
+ * If `false`, loads it into all frames (e.g. iframes).
657
+ * @platform ios
658
+ */
659
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
660
+
661
+ /**
662
+ * Boolean value that determines whether a pull to refresh gesture is
663
+ * available in the `WebView`. The default value is `false`.
664
+ * If `true`, sets `bounces` automatically to `true`
665
+ * @platform ios
666
+ *
667
+ */
668
+ pullToRefreshEnabled?: boolean;
669
+
670
+ /**
671
+ * Boolean value that determines whether the refresh control color is white or not.
672
+ * The default value is `false`, meaning the refresh control color will be the default.
673
+ * @platform ios
674
+ *
675
+ */
676
+ refreshControlLightMode?: boolean;
677
+
678
+ /**
679
+ * Determines the style of the scroll indicators. This property works the same
680
+ * as `indicatorStyle` on React Native's ScrollView.
681
+ * The default value is `'default'`.
682
+ *
683
+ * Possible values:
684
+ * - `'default'` - Default style (dark on light backgrounds, light on dark backgrounds)
685
+ * - `'black'` - Black scroll indicators
686
+ * - `'white'` - White scroll indicators
687
+ * @platform ios
688
+ */
689
+ indicatorStyle?: IndicatorStyleType;
690
+
691
+ /**
692
+ * Function that is invoked when the client needs to download a file.
693
+ *
694
+ * iOS 13+ only: If the webview navigates to a URL that results in an HTTP
695
+ * response with a Content-Disposition header 'attachment...', then
696
+ * this will be called.
697
+ *
698
+ * iOS 8+: If the MIME type indicates that the content is not renderable by the
699
+ * webview, that will also cause this to be called. On iOS versions before 13,
700
+ * this is the only condition that will cause this function to be called.
701
+ *
702
+ * The application will need to provide its own code to actually download
703
+ * the file.
704
+ *
705
+ * If not provided, the default is to let the webview try to render the file.
706
+ */
707
+ onFileDownload?: (event: FileDownloadEvent) => void;
708
+
709
+ /**
710
+ * A Boolean value which, when set to `true`, indicates to WebKit that a WKWebView
711
+ * will only navigate to app-bound domains. Once set, any attempt to navigate away
712
+ * from an app-bound domain will fail with the error "App-bound domain failure."
713
+ *
714
+ * Applications can specify up to 10 "app-bound" domains using a new
715
+ * Info.plist key `WKAppBoundDomains`.
716
+ * @platform ios
717
+ */
718
+ limitsNavigationsToAppBoundDomains?: boolean;
719
+
720
+ /**
721
+ * If false indicates to WebKit that a WKWebView will not interact with text, thus
722
+ * not showing a text selection loop. Only applicable for iOS 14.5 or greater.
723
+ *
724
+ * Defaults to true.
725
+ * @platform ios
726
+ */
727
+ textInteractionEnabled?: boolean;
728
+
729
+ /**
730
+ * This property specifies how to handle media capture permission requests.
731
+ * Defaults to `prompt`, resulting in the user being prompted repeatedly.
732
+ * Available on iOS 15 and later.
733
+ */
734
+ mediaCapturePermissionGrantType?: MediaCapturePermissionGrantType;
735
+
736
+ /**
737
+ * A Boolean value which, when set to `true`, WebView will be rendered with Apple Pay support.
738
+ * Once set, websites will be able to invoke apple pay from React Native Webview.
739
+ * This comes with a cost features like `injectJavaScript`, html5 History,`sharedCookiesEnabled`,
740
+ * `injectedJavaScript`, `injectedJavaScriptBeforeContentLoaded` will not work
741
+ * {@link https://developer.apple.com/documentation/safari-release-notes/safari-13-release-notes#Payment-Request-API ApplePay Doc}
742
+ * if you require to send message to App , webpage has to explicitly call webkit message handler
743
+ * and receive it on `onMessage` handler on react native side
744
+ * @example
745
+ * window.webkit.messageHandlers.ReactNativeWebView.postMessage("hello apple pay")
746
+ * @platform ios
747
+ * The default value is false.
748
+ */
749
+ enableApplePay?: boolean;
750
+
751
+ /**
752
+ * An array of objects which will be shown when selecting text. An empty array will suppress the menu.
753
+ * These will appear after a long press to select text.
754
+ * @platform ios, android
755
+ */
756
+ menuItems?: WebViewCustomMenuItems[];
757
+
758
+ /**
759
+ * An array of strings which will be suppressed from the menu.
760
+ * @platform ios
761
+ */
762
+ suppressMenuItems?: SuppressMenuItem[];
763
+
764
+ /**
765
+ * The function fired when selecting a custom menu item created by `menuItems`.
766
+ * It passes a WebViewEvent with a `nativeEvent`, where custom keys are passed:
767
+ * `customMenuKey`: the string of the menu item
768
+ * `selectedText`: the text selected on the document
769
+ * @platform ios, android
770
+ */
771
+ onCustomMenuSelection?: (event: {
772
+ nativeEvent: {
773
+ label: string;
774
+ key: string;
775
+ selectedText: string;
776
+ };
777
+ }) => void;
778
+
779
+ /**
780
+ * A Boolean value that indicates whether the webview shows warnings for suspected
781
+ * fraudulent content, such as malware or phishing attempts.
782
+ * @platform ios
783
+ */
784
+ fraudulentWebsiteWarningEnabled?: boolean;
785
+
786
+ /**
787
+ * Exodus: Minimum iOS version required to use the WebView.
788
+ * If the device iOS version is below this, the WebView will not render.
789
+ * Supports complex constraints like "12.5.6 <13, 13.6.1 <14, 14.8.1 <15, 15.7.1"
790
+ * @platform ios
791
+ */
792
+ minimumIOSVersion?: string;
793
+
794
+ /**
795
+ * Exodus: Component to render if the iOS version is not supported.
796
+ * If not provided, a default error message will be shown.
797
+ * @platform ios
798
+ */
799
+ unsupportedVersionComponent?: ElementType;
800
+ }
801
+
802
+ export interface MacOSWebViewProps extends WebViewSharedProps {
803
+ /**
804
+ * Does not store any data within the lifetime of the WebView.
805
+ */
806
+ incognito?: boolean;
807
+
808
+ /**
809
+ * Boolean value that determines whether the web view bounces
810
+ * when it reaches the edge of the content. The default value is `true`.
811
+ * @platform macos
812
+ */
813
+ bounces?: boolean;
814
+
815
+ /**
816
+ * Boolean value that determines whether scrolling is enabled in the
817
+ * `WebView`. The default value is `true`.
818
+ * @platform macos
819
+ */
820
+ scrollEnabled?: boolean;
821
+
822
+ /**
823
+ * If the value of this property is true, the scroll view stops on multiples
824
+ * of the scroll view's bounds when the user scrolls.
825
+ * The default value is false.
826
+ * @platform macos
827
+ */
828
+ pagingEnabled?: boolean;
829
+
830
+ /**
831
+ * Controls whether to adjust the content inset for web views that are
832
+ * placed behind a navigation bar, tab bar, or toolbar. The default value
833
+ * is `true`.
834
+ * @platform macos
835
+ */
836
+ automaticallyAdjustContentInsets?: boolean;
837
+
838
+ /**
839
+ * This property specifies how the safe area insets are used to modify the
840
+ * content area of the scroll view. The default value of this property is
841
+ * "never". Available on iOS 11 and later.
842
+ */
843
+ contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
844
+
845
+ /**
846
+ * The amount by which the web view content is inset from the edges of
847
+ * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
848
+ * @platform macos
849
+ */
850
+ contentInset?: ContentInsetProp;
851
+
852
+ /**
853
+ * Boolean that determines whether HTML5 videos play inline or use the
854
+ * native full-screen controller. The default value is `false`.
855
+ *
856
+ * **NOTE** : In order for video to play inline, not only does this
857
+ * property need to be set to `true`, but the video element in the HTML
858
+ * document must also include the `webkit-playsinline` attribute.
859
+ * @platform macos
860
+ */
861
+ allowsInlineMediaPlayback?: boolean;
862
+ /**
863
+ * Boolean value that indicates whether HTML5 videos can play Picture in Picture.
864
+ * The default value is `true`.
865
+ *
866
+ * @platform ios
867
+ */
868
+ allowsPictureInPictureMediaPlayback?: boolean;
869
+ /**
870
+ * A Boolean value indicating whether AirPlay is allowed. The default value is `false`.
871
+ * @platform macos
872
+ */
873
+ allowsAirPlayForMediaPlayback?: boolean;
874
+ /**
875
+ * Hide the accessory view when the keyboard is open. Default is false to be
876
+ * backward compatible.
877
+ */
878
+ hideKeyboardAccessoryView?: boolean;
879
+ /**
880
+ * A Boolean value indicating whether horizontal swipe gestures will trigger
881
+ * back-forward list navigations.
882
+ */
883
+ allowsBackForwardNavigationGestures?: boolean;
884
+ /**
885
+ * A Boolean value indicating whether WebKit WebView should be created using a shared
886
+ * process pool, enabling WebViews to share cookies and localStorage between each other.
887
+ * Default is true but can be set to false for backwards compatibility.
888
+ * @platform macos
889
+ */
890
+ useSharedProcessPool?: boolean;
891
+
892
+ /**
893
+ * The custom user agent string.
894
+ */
895
+ userAgent?: string;
896
+
897
+ /**
898
+ * A Boolean value that determines whether pressing on a link
899
+ * displays a preview of the destination for the link.
900
+ *
901
+ * This property is available on devices that support Force Touch trackpad.
902
+ * @platform macos
903
+ */
904
+ allowsLinkPreview?: boolean;
905
+
906
+ /**
907
+ * Set true if shared cookies from HTTPCookieStorage should used for every load request.
908
+ * The default value is `false`.
909
+ * @platform macos
910
+ */
911
+ sharedCookiesEnabled?: boolean;
912
+
913
+ /**
914
+ * A Boolean value that determines whether scrolling is disabled in a particular direction.
915
+ * The default value is `true`.
916
+ * @platform macos
917
+ */
918
+ directionalLockEnabled?: boolean;
919
+
920
+ /**
921
+ * A Boolean value indicating whether web content can programmatically display the keyboard.
922
+ *
923
+ * When this property is set to true, the user must explicitly tap the elements in the
924
+ * web view to display the keyboard (or other relevant input view) for that element.
925
+ * When set to false, a focus event on an element causes the input view to be displayed
926
+ * and associated with that element automatically.
927
+ *
928
+ * The default value is `true`.
929
+ * @platform macos
930
+ */
931
+ keyboardDisplayRequiresUserAction?: boolean;
932
+
933
+ /**
934
+ * A String value that indicates which URLs the WebView's file can then
935
+ * reference in scripts, AJAX requests, and CSS imports. This is only used
936
+ * for WebViews that are loaded with a source.uri set to a `'file://'` URL.
937
+ *
938
+ * If not provided, the default is to only allow read access to the URL
939
+ * provided in source.uri itself.
940
+ * @platform macos
941
+ */
942
+ allowingReadAccessToURL?: string;
943
+
944
+ /**
945
+ * Boolean that sets whether JavaScript running in the context of a file
946
+ * scheme URL should be allowed to access content from other file scheme URLs.
947
+ * Including accessing content from other file scheme URLs
948
+ * @platform macos
949
+ */
950
+ allowFileAccessFromFileURLs?: boolean;
951
+
952
+ /**
953
+ * Boolean that sets whether JavaScript running in the context of a file
954
+ * scheme URL should be allowed to access content from any origin.
955
+ * Including accessing content from other file scheme URLs
956
+ * @platform macos
957
+ */
958
+ allowUniversalAccessFromFileURLs?: boolean;
959
+
960
+ /**
961
+ * Function that is invoked when the WebKit WebView content process gets terminated.
962
+ * @platform macos
963
+ */
964
+ onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
965
+ }
966
+
967
+ export interface AndroidWebViewProps extends WebViewSharedProps {
968
+ onNavigationStateChange?: (event: WebViewNavigation) => void;
969
+ onContentSizeChange?: (event: WebViewEvent) => void;
970
+
971
+ /**
972
+ * Function that is invoked when the `WebView` process crashes or is killed by the OS.
973
+ * Works only on Android (minimum API level 26).
974
+ */
975
+ onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
976
+
977
+ /**
978
+ * Function that is invoked when the `WebView` should open a new window.
979
+ *
980
+ * This happens when the JS calls `window.open('http://someurl', '_blank')`
981
+ * or when the user clicks on a `<a href="http://someurl" target="_blank">` link.
982
+ *
983
+ * @platform android
984
+ */
985
+ onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
986
+
987
+ /**
988
+ * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
989
+ * Set the cacheMode. Possible values are:
990
+ *
991
+ * - `'LOAD_DEFAULT'` (default)
992
+ * - `'LOAD_CACHE_ELSE_NETWORK'`
993
+ * - `'LOAD_NO_CACHE'`
994
+ * - `'LOAD_CACHE_ONLY'`
995
+ *
996
+ * @platform android
997
+ */
998
+ cacheMode?: CacheMode;
999
+
1000
+ /**
1001
+ * https://developer.android.com/reference/android/view/View#setOverScrollMode(int)
1002
+ * Sets the overScrollMode. Possible values are:
1003
+ *
1004
+ * - `'always'` (default)
1005
+ * - `'content'`
1006
+ * - `'never'`
1007
+ *
1008
+ * @platform android
1009
+ */
1010
+ overScrollMode?: OverScrollModeType;
1011
+
1012
+ /**
1013
+ * Boolean that controls whether the web content is scaled to fit
1014
+ * the view and enables the user to change the scale. The default value
1015
+ * is `true`.
1016
+ */
1017
+ scalesPageToFit?: boolean;
1018
+
1019
+ /**
1020
+ * Sets whether Geolocation is enabled. The default is false.
1021
+ * @platform android
1022
+ */
1023
+ geolocationEnabled?: boolean;
1024
+
1025
+ /**
1026
+ * Boolean that sets whether JavaScript running in the context of a file
1027
+ * scheme URL should be allowed to access content from other file scheme URLs.
1028
+ * Including accessing content from other file scheme URLs
1029
+ * @platform android
1030
+ */
1031
+ allowFileAccessFromFileURLs?: boolean;
1032
+
1033
+ /**
1034
+ * Boolean that sets whether JavaScript running in the context of a file
1035
+ * scheme URL should be allowed to access content from any origin.
1036
+ * Including accessing content from other file scheme URLs
1037
+ * @platform android
1038
+ */
1039
+ allowUniversalAccessFromFileURLs?: boolean;
1040
+
1041
+ /**
1042
+ * Sets whether the webview allow access to file system.
1043
+ * @platform android
1044
+ */
1045
+ allowFileAccess?: boolean;
1046
+
1047
+ /**
1048
+ * Used on Android only, controls whether form autocomplete data should be saved
1049
+ * @platform android
1050
+ */
1051
+ saveFormDataDisabled?: boolean;
1052
+
1053
+ /**
1054
+ * Boolean value to set whether the WebView supports multiple windows. Used on Android only
1055
+ * The default value is `true`.
1056
+ * @platform android
1057
+ */
1058
+ setSupportMultipleWindows?: boolean;
1059
+
1060
+ /**
1061
+ * https://developer.android.com/reference/android/webkit/WebView#setLayerType(int,%20android.graphics.Paint)
1062
+ * Sets the layerType. Possible values are:
1063
+ *
1064
+ * - `'none'` (default)
1065
+ * - `'software'`
1066
+ * - `'hardware'`
1067
+ *
1068
+ * @platform android
1069
+ */
1070
+ androidLayerType?: AndroidLayerType;
1071
+
1072
+ /**
1073
+ * Boolean value to enable third party cookies in the `WebView`. Used on
1074
+ * Android Lollipop and above only as third party cookies are enabled by
1075
+ * default on Android Kitkat and below and on iOS. The default value is `true`.
1076
+ * @platform android
1077
+ */
1078
+ thirdPartyCookiesEnabled?: boolean;
1079
+
1080
+ /**
1081
+ * Boolean value to control whether DOM Storage is enabled. Used only in
1082
+ * Android. The default value is `true`.
1083
+ * @platform android
1084
+ */
1085
+ domStorageEnabled?: boolean;
1086
+
1087
+ /**
1088
+ * Sets the user-agent for the `WebView`.
1089
+ * @platform android
1090
+ */
1091
+ userAgent?: string;
1092
+
1093
+ /**
1094
+ * Sets number that controls text zoom of the page in percent.
1095
+ * @platform android
1096
+ */
1097
+ textZoom?: number;
1098
+
1099
+ /**
1100
+ * Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
1101
+ *
1102
+ * Possible values for `mixedContentMode` are:
1103
+ *
1104
+ * - `'never'` (default) - WebView will not allow a secure origin to load content from an insecure origin.
1105
+ * - `'always'` - WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
1106
+ * - `'compatibility'` - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
1107
+ * @platform android
1108
+ */
1109
+ mixedContentMode?: 'never' | 'always' | 'compatibility';
1110
+
1111
+ /**
1112
+ * Sets ability to open fullscreen videos on Android devices.
1113
+ */
1114
+ allowsFullscreenVideo?: boolean;
1115
+
1116
+ /**
1117
+ * Configuring Dark Theme
1118
+ *
1119
+ * *NOTE* : The force dark setting is not persistent. You must call the static method every time your app process is started.
1120
+ *
1121
+ * *NOTE* : The change from day<->night mode is a configuration change so by default the activity will be restarted
1122
+ * and pickup the new values to apply the theme.
1123
+ * Take care when overriding this default behavior to ensure this method is still called when changes are made.
1124
+ *
1125
+ * @platform android
1126
+ */
1127
+ forceDarkOn?: boolean;
1128
+
1129
+ /**
1130
+ * Boolean value to control whether pinch zoom is enabled. Used only in Android.
1131
+ * Default to true
1132
+ *
1133
+ * @platform android
1134
+ */
1135
+ setBuiltInZoomControls?: boolean;
1136
+
1137
+ /**
1138
+ * Boolean value to control whether built-in zooms controls are displayed. Used only in Android.
1139
+ * Default to false
1140
+ * Controls will always be hidden if setBuiltInZoomControls is set to `false`
1141
+ *
1142
+ * @platform android
1143
+ */
1144
+ setDisplayZoomControls?: boolean;
1145
+
1146
+ /**
1147
+ * Allows to scroll inside the webview when used inside a scrollview.
1148
+ * Behaviour already existing on iOS.
1149
+ * Default to false
1150
+ *
1151
+ * @platform android
1152
+ */
1153
+ nestedScrollEnabled?: boolean;
1154
+
1155
+ /**
1156
+ * Sets the minimum font size.
1157
+ * A non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
1158
+ * Default is 8.
1159
+ * @platform android
1160
+ */
1161
+ minimumFontSize?: number;
1162
+
1163
+ /**
1164
+ * Sets the message to be shown in the toast when downloading via the webview.
1165
+ * Default is 'Downloading'.
1166
+ * @platform android
1167
+ */
1168
+ downloadingMessage?: string;
1169
+
1170
+ /**
1171
+ * Sets the message to be shown in the toast when webview is unable to download due to permissions issue.
1172
+ * Default is 'Cannot download files as permission was denied. Please provide permission to write to storage, in order to download files.'.
1173
+ * @platform android
1174
+ */
1175
+ lackPermissionToDownloadMessage?: string;
1176
+
1177
+ /**
1178
+ * Boolean value to control whether webview can play media protected by DRM.
1179
+ * Default is false.
1180
+ * @platform android
1181
+ */
1182
+ allowsProtectedMedia?: boolean;
1183
+
1184
+ /**
1185
+ * Function that is invoked when the `WebView` receives an SSL error for a sub-resource.
1186
+ *
1187
+ * @param event
1188
+ * @platform android
1189
+ */
1190
+ onLoadSubResourceError?: (event: WebViewErrorEvent) => void;
1191
+ }
1192
+
1193
+ export interface WebViewSharedProps extends ViewProps {
1194
+ /**
1195
+ * Loads static html or a uri (with optional headers) in the WebView.
1196
+ */
1197
+ source?: WebViewSource;
1198
+
1199
+ /**
1200
+ * Boolean value to enable JavaScript in the `WebView`. Used on Android only
1201
+ * as JavaScript is enabled by default on iOS. The default value is `true`.
1202
+ * @platform android
1203
+ */
1204
+ javaScriptEnabled?: boolean;
1205
+
1206
+ /**
1207
+ * A Boolean value indicating whether JavaScript can open windows without user interaction.
1208
+ * The default value is `false`.
1209
+ */
1210
+ javaScriptCanOpenWindowsAutomatically?: boolean;
1211
+
1212
+ /**
1213
+ * Stylesheet object to set the style of the container view.
1214
+ */
1215
+ containerStyle?: StyleProp<ViewStyle>;
1216
+
1217
+ /**
1218
+ * Function that returns a view to show if there's an error.
1219
+ */
1220
+ renderError?: (
1221
+ errorDomain: string | undefined,
1222
+ errorCode: number,
1223
+ errorDesc: string
1224
+ ) => ReactElement; // view to show if there's an error
1225
+
1226
+ /**
1227
+ * Function that returns a loading indicator.
1228
+ */
1229
+ renderLoading?: () => ReactElement;
1230
+
1231
+ /**
1232
+ * Function that is invoked when the `WebView` scrolls.
1233
+ */
1234
+ onScroll?: ComponentProps<typeof NativeWebViewComponent>['onScroll'];
1235
+
1236
+ /**
1237
+ * Function that is invoked when the `WebView` has finished loading.
1238
+ */
1239
+ onLoad?: (event: WebViewNavigationEvent) => void;
1240
+
1241
+ /**
1242
+ * Function that is invoked when the `WebView` load succeeds or fails.
1243
+ */
1244
+ onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
1245
+
1246
+ /**
1247
+ * Function that is invoked when the `WebView` starts loading.
1248
+ */
1249
+ onLoadStart?: (event: WebViewNavigationEvent) => void;
1250
+
1251
+ /**
1252
+ * Function that is invoked when the `WebView` load fails.
1253
+ */
1254
+ onError?: (event: WebViewErrorEvent) => void;
1255
+
1256
+ /**
1257
+ * Function that is invoked when the `WebView` receives an error status code.
1258
+ * Works on iOS and Android (minimum API level 23).
1259
+ */
1260
+ onHttpError?: (event: WebViewHttpErrorEvent) => void;
1261
+
1262
+ /**
1263
+ * Function that is invoked when the `WebView` loading starts or ends.
1264
+ */
1265
+ onNavigationStateChange?: (event: WebViewNavigation) => void;
1266
+
1267
+ /**
1268
+ * Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`.
1269
+ * Setting this property will inject this global into your webview.
1270
+ *
1271
+ * `window.ReactNativeWebView.postMessage` accepts one argument, `data`, which will be
1272
+ * available on the event object, `event.nativeEvent.data`. `data` must be a string.
1273
+ *
1274
+ * Exodus: The callback receives validated/transformed data via validateMeta/validateData.
1275
+ */
1276
+ onMessage?: (event: WebViewMessage) => void;
1277
+
1278
+ /**
1279
+ * Function that is invoked when the `WebView` is loading.
1280
+ */
1281
+ onLoadProgress?: (event: WebViewProgressEvent) => void;
1282
+
1283
+ /**
1284
+ * Boolean value that forces the `WebView` to show the loading view
1285
+ * on the first load.
1286
+ */
1287
+ startInLoadingState?: boolean;
1288
+
1289
+ /**
1290
+ * Set this to provide JavaScript that will be injected into the web page
1291
+ * when the view loads.
1292
+ */
1293
+ injectedJavaScript?: string;
1294
+
1295
+ /**
1296
+ * Set this to provide JavaScript that will be injected into the web page
1297
+ * once the webview is initialized but before the view loads any content.
1298
+ */
1299
+ injectedJavaScriptBeforeContentLoaded?: string;
1300
+
1301
+ /**
1302
+ * If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
1303
+ * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
1304
+ */
1305
+ injectedJavaScriptForMainFrameOnly?: boolean;
1306
+
1307
+ /**
1308
+ * If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
1309
+ * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
1310
+ */
1311
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
1312
+
1313
+ /**
1314
+ * Boolean value that determines whether a horizontal scroll indicator is
1315
+ * shown in the `WebView`. The default value is `true`.
1316
+ */
1317
+ showsHorizontalScrollIndicator?: boolean;
1318
+
1319
+ /**
1320
+ * Boolean value that determines whether a vertical scroll indicator is
1321
+ * shown in the `WebView`. The default value is `true`.
1322
+ */
1323
+ showsVerticalScrollIndicator?: boolean;
1324
+
1325
+ /**
1326
+ * Boolean that determines whether HTML5 audio and video requires the user
1327
+ * to tap them before they start playing. The default value is `true`.
1328
+ */
1329
+ mediaPlaybackRequiresUserAction?: boolean;
1330
+
1331
+ /**
1332
+ * List of origin strings to allow being navigated to. The strings allow
1333
+ * wildcards and get matched against *just* the origin (not the full URL).
1334
+ * If the user taps to navigate to a new page but the new page is not in
1335
+ * this whitelist, we will open the URL in Safari.
1336
+ * The default whitelisted origins are "http://*" and "https://*".
1337
+ */
1338
+ readonly originWhitelist?: string[];
1339
+
1340
+ /**
1341
+ * Exodus: List of protocol schemes to allow being deep linked to.
1342
+ * This requires an exact match. The default behavior is to only allow "https:".
1343
+ * URLs that don't pass the originWhitelist will be checked against this list
1344
+ * to determine if they should be opened externally via Linking.openURL.
1345
+ */
1346
+ readonly deeplinkWhitelist?: string[];
1347
+
1348
+ /**
1349
+ * Function that allows custom handling of any web view requests. Return
1350
+ * `true` from the function to continue loading the request and `false`
1351
+ * to stop loading. The `navigationType` is always `other` on android.
1352
+ */
1353
+ onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest;
1354
+
1355
+ /**
1356
+ * Override the native component used to render the WebView. Enables a custom native
1357
+ * WebView which uses the same JavaScript as the original WebView.
1358
+ */
1359
+ nativeConfig?: WebViewNativeConfig;
1360
+
1361
+ /**
1362
+ * Should caching be enabled. Default is true.
1363
+ */
1364
+ cacheEnabled?: boolean;
1365
+
1366
+ /**
1367
+ * Append to the existing user-agent. Overridden if `userAgent` is set.
1368
+ */
1369
+ applicationNameForUserAgent?: string;
1370
+
1371
+ /**
1372
+ * An object that specifies the credentials of a user to be used for basic authentication.
1373
+ */
1374
+ basicAuthCredential?: BasicAuthCredential;
1375
+
1376
+ /**
1377
+ * Inject a JavaScript object to be accessed as a JSON string via JavaScript in the WebView.
1378
+ */
1379
+ injectedJavaScriptObject?: object;
1380
+
1381
+ /**
1382
+ * Enables WebView remote debugging using Chrome (Android) or Safari (iOS).
1383
+ */
1384
+ webviewDebuggingEnabled?: boolean;
1385
+
1386
+ /**
1387
+ * Enables support for the Payment Request API for the WebView
1388
+ */
1389
+ paymentRequestEnabled?: boolean;
1390
+
1391
+ /**
1392
+ * Exodus: Event metadata validation.
1393
+ * Function to validate/transform event metadata before it reaches the app.
1394
+ */
1395
+ validateMeta: (event: WebViewNativeEvent) => WebViewNativeEvent;
1396
+
1397
+ /**
1398
+ * Exodus: Event data validation.
1399
+ * Function to validate/transform message data before it reaches the app.
1400
+ */
1401
+ validateData: (data: object) => object;
1402
+ }