@exodus/react-native-webview 9.4.0-no-android.0 → 11.26.1-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 (49) hide show
  1. package/README.md +21 -18
  2. package/android/.editorconfig +6 -0
  3. package/android/build.gradle +137 -0
  4. package/android/gradle.properties +6 -0
  5. package/android/src/main/AndroidManifest.xml +15 -0
  6. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewFileProvider.java +14 -0
  7. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +1650 -0
  8. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java +550 -0
  9. package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewPackage.kt +15 -0
  10. package/android/src/main/java/com/reactnativecommunity/webview/WebViewConfig.java +12 -0
  11. package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +25 -0
  12. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingErrorEvent.kt +25 -0
  13. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingFinishEvent.kt +24 -0
  14. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingProgressEvent.kt +24 -0
  15. package/android/src/main/java/com/reactnativecommunity/webview/events/TopLoadingStartEvent.kt +25 -0
  16. package/android/src/main/java/com/reactnativecommunity/webview/events/TopMessageEvent.kt +24 -0
  17. package/android/src/main/java/com/reactnativecommunity/webview/events/TopRenderProcessGoneEvent.kt +26 -0
  18. package/android/src/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt +29 -0
  19. package/android/src/main/res/xml/file_provider_paths.xml +6 -0
  20. package/apple/RNCWKProcessPoolManager.h +15 -0
  21. package/apple/RNCWKProcessPoolManager.m +36 -0
  22. package/apple/RNCWebView.h +117 -0
  23. package/apple/RNCWebView.m +1532 -0
  24. package/apple/RNCWebViewManager.h +13 -0
  25. package/apple/RNCWebViewManager.m +288 -0
  26. package/index.d.ts +65 -0
  27. package/index.js +4 -0
  28. package/ios/RNCWebView.xcodeproj/project.pbxproj +2 -0
  29. package/lib/WebView.android.d.ts +7 -0
  30. package/lib/WebView.android.js +112 -1
  31. package/lib/WebView.d.ts +7 -0
  32. package/lib/WebView.ios.d.ts +7 -0
  33. package/lib/WebView.ios.js +134 -202
  34. package/lib/WebView.js +9 -2
  35. package/lib/WebView.styles.d.ts +12 -0
  36. package/lib/WebView.styles.js +7 -7
  37. package/lib/WebViewNativeComponent.android.d.ts +4 -0
  38. package/lib/WebViewNativeComponent.android.js +3 -0
  39. package/lib/WebViewNativeComponent.ios.d.ts +4 -0
  40. package/lib/WebViewNativeComponent.ios.js +3 -0
  41. package/lib/WebViewShared.d.ts +37 -0
  42. package/lib/WebViewShared.js +121 -24
  43. package/lib/WebViewTypes.d.ts +893 -0
  44. package/lib/WebViewTypes.js +31 -16
  45. package/lib/index.d.ts +4 -0
  46. package/lib/index.js +3 -0
  47. package/package.json +83 -87
  48. package/react-native-webview.podspec +3 -3
  49. package/react-native.config.js +37 -0
@@ -0,0 +1,893 @@
1
+ import { ReactElement, Component } from 'react';
2
+ import { NativeSyntheticEvent, ViewProps, StyleProp, ViewStyle, NativeMethodsMixin, Constructor, UIManagerStatic, NativeScrollEvent } from 'react-native';
3
+ declare type WebViewCommands = 'goForward' | 'goBack' | 'reload' | 'stopLoading' | 'postMessage' | 'injectJavaScript' | 'loadUrl' | 'requestFocus';
4
+ declare type AndroidWebViewCommands = 'clearHistory' | 'clearCache' | 'clearFormData';
5
+ interface RNCWebViewUIManager<Commands extends string> extends UIManagerStatic {
6
+ getViewManagerConfig: (name: string) => {
7
+ Commands: {
8
+ [key in Commands]: number;
9
+ };
10
+ };
11
+ }
12
+ export declare type RNCWebViewUIManagerAndroid = RNCWebViewUIManager<WebViewCommands | AndroidWebViewCommands>;
13
+ export declare type RNCWebViewUIManagerIOS = RNCWebViewUIManager<WebViewCommands>;
14
+ declare type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
15
+ interface BaseState {
16
+ viewState: WebViewState;
17
+ }
18
+ interface NormalState extends BaseState {
19
+ viewState: 'IDLE' | 'LOADING';
20
+ lastErrorEvent: WebViewError | null;
21
+ }
22
+ interface ErrorState extends BaseState {
23
+ viewState: 'ERROR';
24
+ lastErrorEvent: WebViewError;
25
+ }
26
+ export declare type State = NormalState | ErrorState;
27
+ declare class NativeWebViewIOSComponent extends Component<IOSNativeWebViewProps> {
28
+ }
29
+ declare const NativeWebViewIOSBase: Constructor<NativeMethodsMixin> & typeof NativeWebViewIOSComponent;
30
+ export declare class NativeWebViewIOS extends NativeWebViewIOSBase {
31
+ }
32
+ declare class NativeWebViewAndroidComponent extends Component<AndroidNativeWebViewProps> {
33
+ }
34
+ declare const NativeWebViewAndroidBase: Constructor<NativeMethodsMixin> & typeof NativeWebViewAndroidComponent;
35
+ export declare class NativeWebViewAndroid extends NativeWebViewAndroidBase {
36
+ }
37
+ export interface ContentInsetProp {
38
+ top?: number;
39
+ left?: number;
40
+ bottom?: number;
41
+ right?: number;
42
+ }
43
+ export interface WebViewNativeEvent {
44
+ url: string;
45
+ loading: boolean;
46
+ title: string;
47
+ canGoBack: boolean;
48
+ canGoForward: boolean;
49
+ lockIdentifier: number;
50
+ }
51
+ export interface WebViewNativeProgressEvent extends WebViewNativeEvent {
52
+ progress: number;
53
+ }
54
+ export interface WebViewNavigation extends WebViewNativeEvent {
55
+ navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other';
56
+ mainDocumentURL?: string;
57
+ }
58
+ export interface ShouldStartLoadRequest extends WebViewNavigation {
59
+ isTopFrame: boolean;
60
+ }
61
+ export interface FileDownload {
62
+ downloadUrl: string;
63
+ }
64
+ export declare type DecelerationRateConstant = 'normal' | 'fast';
65
+ export interface WebViewMessage extends WebViewNativeEvent {
66
+ data: string;
67
+ }
68
+ export interface WebViewError extends WebViewNativeEvent {
69
+ /**
70
+ * `domain` is only used on iOS and macOS
71
+ */
72
+ domain?: string;
73
+ code: number;
74
+ description: string;
75
+ }
76
+ export interface WebViewHttpError extends WebViewNativeEvent {
77
+ description: string;
78
+ statusCode: number;
79
+ }
80
+ export interface WebViewRenderProcessGoneDetail {
81
+ didCrash: boolean;
82
+ }
83
+ export declare type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
84
+ export declare type WebViewProgressEvent = NativeSyntheticEvent<WebViewNativeProgressEvent>;
85
+ export declare type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
86
+ export declare type ShouldStartLoadRequestEvent = NativeSyntheticEvent<ShouldStartLoadRequest>;
87
+ export declare type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
88
+ export declare type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
89
+ export declare type WebViewErrorEvent = NativeSyntheticEvent<WebViewError>;
90
+ export declare type WebViewTerminatedEvent = NativeSyntheticEvent<WebViewNativeEvent>;
91
+ export declare type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
92
+ export declare type WebViewRenderProcessGoneEvent = NativeSyntheticEvent<WebViewRenderProcessGoneDetail>;
93
+ export declare type WebViewScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
94
+ export declare type DataDetectorTypes = 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'trackingNumber' | 'flightNumber' | 'lookupSuggestion' | 'none' | 'all';
95
+ export declare type OverScrollModeType = 'always' | 'content' | 'never';
96
+ export declare type CacheMode = 'LOAD_DEFAULT' | 'LOAD_CACHE_ONLY' | 'LOAD_CACHE_ELSE_NETWORK' | 'LOAD_NO_CACHE';
97
+ export declare type AndroidLayerType = 'none' | 'software' | 'hardware';
98
+ export interface WebViewSourceUri {
99
+ /**
100
+ * The URI to load in the `WebView`. Can be a local or remote file.
101
+ */
102
+ uri: string;
103
+ /**
104
+ * The HTTP Method to use. Defaults to GET if not specified.
105
+ * NOTE: On Android, only GET and POST are supported.
106
+ */
107
+ method?: string;
108
+ /**
109
+ * Additional HTTP headers to send with the request.
110
+ * NOTE: On Android, this can only be used with GET requests.
111
+ */
112
+ headers?: Object;
113
+ /**
114
+ * The HTTP body to send with the request. This must be a valid
115
+ * UTF-8 string, and will be sent exactly as specified, with no
116
+ * additional encoding (e.g. URL-escaping or base64) applied.
117
+ * NOTE: On Android, this can only be used with POST requests.
118
+ */
119
+ body?: string;
120
+ }
121
+ export interface WebViewSourceHtml {
122
+ /**
123
+ * A static HTML page to display in the WebView.
124
+ */
125
+ html: string;
126
+ /**
127
+ * The base URL to be used for any relative links in the HTML.
128
+ */
129
+ baseUrl?: string;
130
+ }
131
+ export interface WebViewCustomMenuItems {
132
+ /**
133
+ * The unique key that will be added as a selector on the webview
134
+ * Returned by the `onCustomMenuSelection` callback
135
+ */
136
+ key: string;
137
+ /**
138
+ * The label to appear on the UI Menu when selecting text
139
+ */
140
+ label: string;
141
+ }
142
+ export declare type WebViewSource = WebViewSourceUri | WebViewSourceHtml;
143
+ export interface ViewManager {
144
+ startLoadWithResult: Function;
145
+ }
146
+ export interface WebViewNativeConfig {
147
+ /**
148
+ * The native component used to render the WebView.
149
+ */
150
+ component?: typeof NativeWebViewIOS | typeof NativeWebViewAndroid;
151
+ /**
152
+ * Set props directly on the native component WebView. Enables custom props which the
153
+ * original WebView doesn't pass through.
154
+ */
155
+ props?: Object;
156
+ /**
157
+ * Set the ViewManager to use for communication with the native side.
158
+ * @platform ios, macos
159
+ */
160
+ viewManager?: ViewManager;
161
+ }
162
+ export declare type OnShouldStartLoadWithRequest = (event: ShouldStartLoadRequest) => boolean;
163
+ export interface BasicAuthCredential {
164
+ /**
165
+ * A username used for basic authentication.
166
+ */
167
+ username: string;
168
+ /**
169
+ * A password used for basic authentication.
170
+ */
171
+ password: string;
172
+ }
173
+ export interface CommonNativeWebViewProps extends ViewProps {
174
+ cacheEnabled?: boolean;
175
+ incognito?: boolean;
176
+ injectedJavaScript?: string;
177
+ injectedJavaScriptBeforeContentLoaded?: string;
178
+ injectedJavaScriptForMainFrameOnly?: boolean;
179
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
180
+ mediaPlaybackRequiresUserAction?: boolean;
181
+ messagingEnabled: boolean;
182
+ onScroll?: (event: WebViewScrollEvent) => void;
183
+ onLoadingError: (event: WebViewErrorEvent) => void;
184
+ onLoadingFinish: (event: WebViewNavigationEvent) => void;
185
+ onLoadingProgress: (event: WebViewProgressEvent) => void;
186
+ onLoadingStart: (event: WebViewNavigationEvent) => void;
187
+ onHttpError: (event: WebViewHttpErrorEvent) => void;
188
+ onMessage: (event: WebViewMessageEvent) => void;
189
+ onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
190
+ showsHorizontalScrollIndicator?: boolean;
191
+ showsVerticalScrollIndicator?: boolean;
192
+ source: any;
193
+ userAgent?: string;
194
+ /**
195
+ * Append to the existing user-agent. Overridden if `userAgent` is set.
196
+ */
197
+ applicationNameForUserAgent?: string;
198
+ basicAuthCredential?: BasicAuthCredential;
199
+ }
200
+ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
201
+ cacheMode?: CacheMode;
202
+ allowFileAccess?: boolean;
203
+ scalesPageToFit?: boolean;
204
+ allowFileAccessFromFileURLs?: boolean;
205
+ allowsFullscreenVideo?: boolean;
206
+ allowUniversalAccessFromFileURLs?: boolean;
207
+ androidHardwareAccelerationDisabled?: boolean;
208
+ androidLayerType?: AndroidLayerType;
209
+ domStorageEnabled?: boolean;
210
+ geolocationEnabled?: boolean;
211
+ javaScriptEnabled?: boolean;
212
+ mixedContentMode?: 'never' | 'always' | 'compatibility';
213
+ onContentSizeChange?: (event: WebViewEvent) => void;
214
+ onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
215
+ overScrollMode?: OverScrollModeType;
216
+ saveFormDataDisabled?: boolean;
217
+ setSupportMultipleWindows?: boolean;
218
+ textZoom?: number;
219
+ thirdPartyCookiesEnabled?: boolean;
220
+ messagingModuleName?: string;
221
+ setBuiltInZoomControls?: boolean;
222
+ setDisplayZoomControls?: boolean;
223
+ nestedScrollEnabled?: boolean;
224
+ readonly urlPrefixesForDefaultIntent?: string[];
225
+ forceDarkOn?: boolean;
226
+ minimumFontSize?: number;
227
+ downloadingMessage?: string;
228
+ lackPermissionToDownloadMessage?: string;
229
+ allowsProtectedMedia?: boolean;
230
+ }
231
+ export declare type ContentInsetAdjustmentBehavior = 'automatic' | 'scrollableAxes' | 'never' | 'always';
232
+ export declare type MediaCapturePermissionGrantType = 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny' | 'deny' | 'grant' | 'prompt';
233
+ export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
234
+ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
235
+ allowingReadAccessToURL?: string;
236
+ allowsBackForwardNavigationGestures?: boolean;
237
+ allowsInlineMediaPlayback?: boolean;
238
+ allowsAirPlayForMediaPlayback?: boolean;
239
+ allowsLinkPreview?: boolean;
240
+ allowFileAccessFromFileURLs?: boolean;
241
+ allowUniversalAccessFromFileURLs?: boolean;
242
+ automaticallyAdjustContentInsets?: boolean;
243
+ autoManageStatusBarEnabled?: boolean;
244
+ bounces?: boolean;
245
+ contentInset?: ContentInsetProp;
246
+ contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
247
+ contentMode?: ContentMode;
248
+ readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
249
+ decelerationRate?: number;
250
+ directionalLockEnabled?: boolean;
251
+ hideKeyboardAccessoryView?: boolean;
252
+ javaScriptEnabled?: boolean;
253
+ pagingEnabled?: boolean;
254
+ scrollEnabled?: boolean;
255
+ useSharedProcessPool?: boolean;
256
+ onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
257
+ injectedJavaScriptForMainFrameOnly?: boolean;
258
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
259
+ onFileDownload?: (event: FileDownloadEvent) => void;
260
+ limitsNavigationsToAppBoundDomains?: boolean;
261
+ textInteractionEnabled?: boolean;
262
+ mediaCapturePermissionGrantType?: MediaCapturePermissionGrantType;
263
+ }
264
+ export interface IOSWebViewProps extends WebViewSharedProps {
265
+ /**
266
+ * Does not store any data within the lifetime of the WebView.
267
+ */
268
+ incognito?: boolean;
269
+ /**
270
+ * Boolean value that determines whether the web view bounces
271
+ * when it reaches the edge of the content. The default value is `true`.
272
+ * @platform ios
273
+ */
274
+ bounces?: boolean;
275
+ /**
276
+ * A floating-point number that determines how quickly the scroll view
277
+ * decelerates after the user lifts their finger. You may also use the
278
+ * string shortcuts `"normal"` and `"fast"` which match the underlying iOS
279
+ * settings for `UIScrollViewDecelerationRateNormal` and
280
+ * `UIScrollViewDecelerationRateFast` respectively:
281
+ *
282
+ * - normal: 0.998
283
+ * - fast: 0.99 (the default for iOS web view)
284
+ * @platform ios
285
+ */
286
+ decelerationRate?: DecelerationRateConstant | number;
287
+ /**
288
+ * Boolean value that determines whether scrolling is enabled in the
289
+ * `WebView`. The default value is `true`.
290
+ * @platform ios
291
+ */
292
+ scrollEnabled?: boolean;
293
+ /**
294
+ * If the value of this property is true, the scroll view stops on multiples
295
+ * of the scroll view’s bounds when the user scrolls.
296
+ * The default value is false.
297
+ * @platform ios
298
+ */
299
+ pagingEnabled?: boolean;
300
+ /**
301
+ * Controls whether to adjust the content inset for web views that are
302
+ * placed behind a navigation bar, tab bar, or toolbar. The default value
303
+ * is `true`.
304
+ * @platform ios
305
+ */
306
+ automaticallyAdjustContentInsets?: boolean;
307
+ /**
308
+ * Controls whether to adjust the scroll indicator inset for web views that are
309
+ * placed behind a navigation bar, tab bar, or toolbar. The default value
310
+ * is `false`. (iOS 13+)
311
+ * @platform ios
312
+ */
313
+ automaticallyAdjustsScrollIndicatorInsets?: boolean;
314
+ /**
315
+ * This property specifies how the safe area insets are used to modify the
316
+ * content area of the scroll view. The default value of this property is
317
+ * "never". Available on iOS 11 and later.
318
+ */
319
+ contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
320
+ /**
321
+ * The amount by which the web view content is inset from the edges of
322
+ * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
323
+ * @platform ios
324
+ */
325
+ contentInset?: ContentInsetProp;
326
+ /**
327
+ * Defaults to `recommended`, which loads mobile content on iPhone
328
+ * and iPad Mini but desktop content on other iPads.
329
+ *
330
+ * Possible values are:
331
+ * - `'recommended'`
332
+ * - `'mobile'`
333
+ * - `'desktop'`
334
+ * @platform ios
335
+ */
336
+ contentMode?: ContentMode;
337
+ /**
338
+ * Determines the types of data converted to clickable URLs in the web view's content.
339
+ * By default only phone numbers are detected.
340
+ *
341
+ * You can provide one type or an array of many types.
342
+ *
343
+ * Possible values for `dataDetectorTypes` are:
344
+ *
345
+ * - `'phoneNumber'`
346
+ * - `'link'`
347
+ * - `'address'`
348
+ * - `'calendarEvent'`
349
+ * - `'none'`
350
+ * - `'all'`
351
+ *
352
+ * With the new WebKit implementation, we have three new values:
353
+ * - `'trackingNumber'`,
354
+ * - `'flightNumber'`,
355
+ * - `'lookupSuggestion'`,
356
+ *
357
+ * @platform ios
358
+ */
359
+ readonly dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[];
360
+ /**
361
+ * Boolean that determines whether HTML5 videos play inline or use the
362
+ * native full-screen controller. The default value is `false`.
363
+ *
364
+ * **NOTE** : In order for video to play inline, not only does this
365
+ * property need to be set to `true`, but the video element in the HTML
366
+ * document must also include the `webkit-playsinline` attribute.
367
+ * @platform ios
368
+ */
369
+ allowsInlineMediaPlayback?: boolean;
370
+ /**
371
+ * A Boolean value indicating whether AirPlay is allowed. The default value is `false`.
372
+ * @platform ios
373
+ */
374
+ allowsAirPlayForMediaPlayback?: boolean;
375
+ /**
376
+ * Hide the accessory view when the keyboard is open. Default is false to be
377
+ * backward compatible.
378
+ */
379
+ hideKeyboardAccessoryView?: boolean;
380
+ /**
381
+ * A Boolean value indicating whether horizontal swipe gestures will trigger
382
+ * back-forward list navigations.
383
+ */
384
+ allowsBackForwardNavigationGestures?: boolean;
385
+ /**
386
+ * A Boolean value indicating whether WebKit WebView should be created using a shared
387
+ * process pool, enabling WebViews to share cookies and localStorage between each other.
388
+ * Default is true but can be set to false for backwards compatibility.
389
+ * @platform ios
390
+ */
391
+ useSharedProcessPool?: boolean;
392
+ /**
393
+ * The custom user agent string.
394
+ */
395
+ userAgent?: string;
396
+ /**
397
+ * A Boolean value that determines whether pressing on a link
398
+ * displays a preview of the destination for the link.
399
+ *
400
+ * This property is available on devices that support 3D Touch.
401
+ * In iOS 10 and later, the default value is `true`; before that, the default value is `false`.
402
+ * @platform ios
403
+ */
404
+ allowsLinkPreview?: boolean;
405
+ /**
406
+ * Set true if shared cookies from HTTPCookieStorage should used for every load request.
407
+ * The default value is `false`.
408
+ * @platform ios
409
+ */
410
+ sharedCookiesEnabled?: boolean;
411
+ /**
412
+ * When set to true the hardware silent switch is ignored.
413
+ * The default value is `false`.
414
+ * @platform ios
415
+ */
416
+ ignoreSilentHardwareSwitch?: boolean;
417
+ /**
418
+ * Set true if StatusBar should be light when user watch video fullscreen.
419
+ * The default value is `true`.
420
+ * @platform ios
421
+ */
422
+ autoManageStatusBarEnabled?: boolean;
423
+ /**
424
+ * A Boolean value that determines whether scrolling is disabled in a particular direction.
425
+ * The default value is `true`.
426
+ * @platform ios
427
+ */
428
+ directionalLockEnabled?: boolean;
429
+ /**
430
+ * A Boolean value indicating whether web content can programmatically display the keyboard.
431
+ *
432
+ * When this property is set to true, the user must explicitly tap the elements in the
433
+ * web view to display the keyboard (or other relevant input view) for that element.
434
+ * When set to false, a focus event on an element causes the input view to be displayed
435
+ * and associated with that element automatically.
436
+ *
437
+ * The default value is `true`.
438
+ * @platform ios
439
+ */
440
+ keyboardDisplayRequiresUserAction?: boolean;
441
+ /**
442
+ * A String value that indicates which URLs the WebView's file can then
443
+ * reference in scripts, AJAX requests, and CSS imports. This is only used
444
+ * for WebViews that are loaded with a source.uri set to a `'file://'` URL.
445
+ *
446
+ * If not provided, the default is to only allow read access to the URL
447
+ * provided in source.uri itself.
448
+ * @platform ios
449
+ */
450
+ allowingReadAccessToURL?: string;
451
+ /**
452
+ * Boolean that sets whether JavaScript running in the context of a file
453
+ * scheme URL should be allowed to access content from other file scheme URLs.
454
+ * Including accessing content from other file scheme URLs
455
+ * @platform ios
456
+ */
457
+ allowFileAccessFromFileURLs?: boolean;
458
+ /**
459
+ * Boolean that sets whether JavaScript running in the context of a file
460
+ * scheme URL should be allowed to access content from any origin.
461
+ * Including accessing content from other file scheme URLs
462
+ * @platform ios
463
+ */
464
+ allowUniversalAccessFromFileURLs?: boolean;
465
+ /**
466
+ * Function that is invoked when the WebKit WebView content process gets terminated.
467
+ * @platform ios
468
+ */
469
+ onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
470
+ /**
471
+ * If `true` (default), loads the `injectedJavaScript` only into the main frame.
472
+ * If `false`, loads it into all frames (e.g. iframes).
473
+ * @platform ios
474
+ */
475
+ injectedJavaScriptForMainFrameOnly?: boolean;
476
+ /**
477
+ * If `true` (default), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
478
+ * If `false`, loads it into all frames (e.g. iframes).
479
+ * @platform ios
480
+ */
481
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
482
+ /**
483
+ * Boolean value that determines whether a pull to refresh gesture is
484
+ * available in the `WebView`. The default value is `false`.
485
+ * If `true`, sets `bounces` automatically to `true`
486
+ * @platform ios
487
+ *
488
+ */
489
+ pullToRefreshEnabled?: boolean;
490
+ /**
491
+ * Function that is invoked when the client needs to download a file.
492
+ *
493
+ * iOS 13+ only: If the webview navigates to a URL that results in an HTTP
494
+ * response with a Content-Disposition header 'attachment...', then
495
+ * this will be called.
496
+ *
497
+ * iOS 8+: If the MIME type indicates that the content is not renderable by the
498
+ * webview, that will also cause this to be called. On iOS versions before 13,
499
+ * this is the only condition that will cause this function to be called.
500
+ *
501
+ * The application will need to provide its own code to actually download
502
+ * the file.
503
+ *
504
+ * If not provided, the default is to let the webview try to render the file.
505
+ */
506
+ onFileDownload?: (event: FileDownloadEvent) => void;
507
+ /**
508
+ * A Boolean value which, when set to `true`, indicates to WebKit that a WKWebView
509
+ * will only navigate to app-bound domains. Once set, any attempt to navigate away
510
+ * from an app-bound domain will fail with the error “App-bound domain failure.”
511
+ *
512
+ * Applications can specify up to 10 “app-bound” domains using a new
513
+ * Info.plist key `WKAppBoundDomains`.
514
+ * @platform ios
515
+ */
516
+ limitsNavigationsToAppBoundDomains?: boolean;
517
+ /**
518
+ * If false indicates to WebKit that a WKWebView will not interact with text, thus
519
+ * not showing a text selection loop. Only applicable for iOS 14.5 or greater.
520
+ *
521
+ * Defaults to true.
522
+ * @platform ios
523
+ */
524
+ textInteractionEnabled?: boolean;
525
+ /**
526
+ * This property specifies how to handle media capture permission requests.
527
+ * Defaults to `prompt`, resulting in the user being prompted repeatedly.
528
+ * Available on iOS 15 and later.
529
+ */
530
+ mediaCapturePermissionGrantType?: MediaCapturePermissionGrantType;
531
+ /**
532
+ * A Boolean value which, when set to `true`, WebView will be rendered with Apple Pay support.
533
+ * Once set, websites will be able to invoke apple pay from React Native Webview.
534
+ * This comes with a cost features like `injectJavaScript`, html5 History,`sharedCookiesEnabled`,
535
+ * `injectedJavaScript`, `injectedJavaScriptBeforeContentLoaded` will not work
536
+ * {@link https://developer.apple.com/documentation/safari-release-notes/safari-13-release-notes#Payment-Request-API ApplePay Doc}
537
+ * if you require to send message to App , webpage has to explicitly call webkit message handler
538
+ * and receive it on `onMessage` handler on react native side
539
+ * @example
540
+ * window.webkit.messageHandlers.ReactNativeWebView.postMessage("hello apple pay")
541
+ * @platform ios
542
+ * The default value is false.
543
+ */
544
+ enableApplePay?: boolean;
545
+ /**
546
+ * An array of objects which will be added to the UIMenu controller when selecting text.
547
+ * These will appear after a long press to select text.
548
+ * @platform ios
549
+ */
550
+ menuItems?: WebViewCustomMenuItems[];
551
+ /**
552
+ * The function fired when selecting a custom menu item created by `menuItems`.
553
+ * It passes a WebViewEvent with a `nativeEvent`, where custom keys are passed:
554
+ * `customMenuKey`: the string of the menu item
555
+ * `selectedText`: the text selected on the document
556
+ * @platform ios
557
+ */
558
+ onCustomMenuSelection?: (event: WebViewEvent) => void;
559
+ }
560
+ export interface AndroidWebViewProps extends WebViewSharedProps {
561
+ onNavigationStateChange?: (event: WebViewNavigation) => void;
562
+ onContentSizeChange?: (event: WebViewEvent) => void;
563
+ /**
564
+ * Function that is invoked when the `WebView` process crashes or is killed by the OS.
565
+ * Works only on Android (minimum API level 26).
566
+ */
567
+ onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
568
+ /**
569
+ * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
570
+ * Set the cacheMode. Possible values are:
571
+ *
572
+ * - `'LOAD_DEFAULT'` (default)
573
+ * - `'LOAD_CACHE_ELSE_NETWORK'`
574
+ * - `'LOAD_NO_CACHE'`
575
+ * - `'LOAD_CACHE_ONLY'`
576
+ *
577
+ * @platform android
578
+ */
579
+ cacheMode?: CacheMode;
580
+ /**
581
+ * https://developer.android.com/reference/android/view/View#OVER_SCROLL_NEVER
582
+ * Sets the overScrollMode. Possible values are:
583
+ *
584
+ * - `'always'` (default)
585
+ * - `'content'`
586
+ * - `'never'`
587
+ *
588
+ * @platform android
589
+ */
590
+ overScrollMode?: OverScrollModeType;
591
+ /**
592
+ * Boolean that controls whether the web content is scaled to fit
593
+ * the view and enables the user to change the scale. The default value
594
+ * is `true`.
595
+ */
596
+ scalesPageToFit?: boolean;
597
+ /**
598
+ * Sets whether Geolocation is enabled. The default is false.
599
+ * @platform android
600
+ */
601
+ geolocationEnabled?: boolean;
602
+ /**
603
+ * Boolean that sets whether JavaScript running in the context of a file
604
+ * scheme URL should be allowed to access content from other file scheme URLs.
605
+ * Including accessing content from other file scheme URLs
606
+ * @platform android
607
+ */
608
+ allowFileAccessFromFileURLs?: boolean;
609
+ /**
610
+ * Boolean that sets whether JavaScript running in the context of a file
611
+ * scheme URL should be allowed to access content from any origin.
612
+ * Including accessing content from other file scheme URLs
613
+ * @platform android
614
+ */
615
+ allowUniversalAccessFromFileURLs?: boolean;
616
+ /**
617
+ * Sets whether the webview allow access to file system.
618
+ * @platform android
619
+ */
620
+ allowFileAccess?: boolean;
621
+ /**
622
+ * Used on Android only, controls whether form autocomplete data should be saved
623
+ * @platform android
624
+ */
625
+ saveFormDataDisabled?: boolean;
626
+ /**
627
+ * Boolean value to set whether the WebView supports multiple windows. Used on Android only
628
+ * The default value is `true`.
629
+ * @platform android
630
+ */
631
+ setSupportMultipleWindows?: boolean;
632
+ /**
633
+ * Used on Android only, controls whether the given list of URL prefixes should
634
+ * make {@link com.facebook.react.views.webview.ReactWebViewClient} to launch a
635
+ * default activity intent for those URL instead of loading it within the webview.
636
+ * Use this to list URLs that WebView cannot handle, e.g. a PDF url.
637
+ * @platform android
638
+ */
639
+ readonly urlPrefixesForDefaultIntent?: string[];
640
+ /**
641
+ * Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
642
+ * as Hardware Acceleration is a feature only for Android. The default value is `false`.
643
+ * @platform android
644
+ */
645
+ androidHardwareAccelerationDisabled?: boolean;
646
+ /**
647
+ * https://developer.android.com/reference/android/webkit/WebView#setLayerType(int,%20android.graphics.Paint)
648
+ * Sets the layerType. Possible values are:
649
+ *
650
+ * - `'none'` (default)
651
+ * - `'software'`
652
+ * - `'hardware'`
653
+ *
654
+ * @platform android
655
+ */
656
+ androidLayerType?: AndroidLayerType;
657
+ /**
658
+ * Boolean value to enable third party cookies in the `WebView`. Used on
659
+ * Android Lollipop and above only as third party cookies are enabled by
660
+ * default on Android Kitkat and below and on iOS. The default value is `true`.
661
+ * @platform android
662
+ */
663
+ thirdPartyCookiesEnabled?: boolean;
664
+ /**
665
+ * Boolean value to control whether DOM Storage is enabled. Used only in
666
+ * Android.
667
+ * @platform android
668
+ */
669
+ domStorageEnabled?: boolean;
670
+ /**
671
+ * Sets the user-agent for the `WebView`.
672
+ * @platform android
673
+ */
674
+ userAgent?: string;
675
+ /**
676
+ * Sets number that controls text zoom of the page in percent.
677
+ * @platform android
678
+ */
679
+ textZoom?: number;
680
+ /**
681
+ * Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
682
+ *
683
+ * Possible values for `mixedContentMode` are:
684
+ *
685
+ * - `'never'` (default) - WebView will not allow a secure origin to load content from an insecure origin.
686
+ * - `'always'` - WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
687
+ * - `'compatibility'` - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
688
+ * @platform android
689
+ */
690
+ mixedContentMode?: 'never' | 'always' | 'compatibility';
691
+ /**
692
+ * Sets ability to open fullscreen videos on Android devices.
693
+ */
694
+ allowsFullscreenVideo?: boolean;
695
+ /**
696
+ * Configuring Dark Theme
697
+ *
698
+ * *NOTE* : The force dark setting is not persistent. You must call the static method every time your app process is started.
699
+ *
700
+ * *NOTE* : The change from day<->night mode is a configuration change so by default the activity will be restarted
701
+ * and pickup the new values to apply the theme.
702
+ * Take care when overriding this default behavior to ensure this method is still called when changes are made.
703
+ *
704
+ * @platform android
705
+ */
706
+ forceDarkOn?: boolean;
707
+ /**
708
+ * Boolean value to control whether pinch zoom is enabled. Used only in Android.
709
+ * Default to true
710
+ *
711
+ * @platform android
712
+ */
713
+ setBuiltInZoomControls?: boolean;
714
+ /**
715
+ * Boolean value to control whether built-in zooms controls are displayed. Used only in Android.
716
+ * Default to false
717
+ * Controls will always be hidden if setBuiltInZoomControls is set to `false`
718
+ *
719
+ * @platform android
720
+ */
721
+ setDisplayZoomControls?: boolean;
722
+ /**
723
+ * Allows to scroll inside the webview when used inside a scrollview.
724
+ * Behaviour already existing on iOS.
725
+ * Default to false
726
+ *
727
+ * @platform android
728
+ */
729
+ nestedScrollEnabled?: boolean;
730
+ /**
731
+ * Sets the minimum font size.
732
+ * A non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
733
+ * Default is 8.
734
+ * @platform android
735
+ */
736
+ minimumFontSize?: number;
737
+ /**
738
+ * Sets the message to be shown in the toast when downloading via the webview.
739
+ * Default is 'Downloading'.
740
+ * @platform android
741
+ */
742
+ downloadingMessage?: string;
743
+ /**
744
+ * Sets the message to be shown in the toast when webview is unable to download due to permissions issue.
745
+ * Default is 'Cannot download files as permission was denied. Please provide permission to write to storage, in order to download files.'.
746
+ * @platform android
747
+ */
748
+ lackPermissionToDownloadMessage?: string;
749
+ /**
750
+ * Boolean value to control whether webview can play media protected by DRM.
751
+ * Default is false.
752
+ * @platform android
753
+ */
754
+ allowsProtectedMedia?: boolean;
755
+ }
756
+ export interface WebViewSharedProps extends ViewProps {
757
+ /**
758
+ * Loads static html or a uri (with optional headers) in the WebView.
759
+ */
760
+ source?: WebViewSource;
761
+ /**
762
+ * Boolean value to enable JavaScript in the `WebView`. Used on Android only
763
+ * as JavaScript is enabled by default on iOS. The default value is `true`.
764
+ * @platform android
765
+ */
766
+ javaScriptEnabled?: boolean;
767
+ /**
768
+ * Stylesheet object to set the style of the container view.
769
+ */
770
+ containerStyle?: StyleProp<ViewStyle>;
771
+ /**
772
+ * Function that returns a view to show if there's an error.
773
+ */
774
+ renderError?: (errorDomain: string | undefined, errorCode: number, errorDesc: string) => ReactElement;
775
+ /**
776
+ * Function that returns a loading indicator.
777
+ */
778
+ renderLoading?: () => ReactElement;
779
+ /**
780
+ * Function that is invoked when the `WebView` scrolls.
781
+ */
782
+ onScroll?: (event: WebViewScrollEvent) => void;
783
+ /**
784
+ * Function that is invoked when the `WebView` has finished loading.
785
+ */
786
+ onLoad?: (event: WebViewNavigationEvent) => void;
787
+ /**
788
+ * Function that is invoked when the `WebView` load succeeds or fails.
789
+ */
790
+ onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void;
791
+ /**
792
+ * Function that is invoked when the `WebView` starts loading.
793
+ */
794
+ onLoadStart?: (event: WebViewNavigationEvent) => void;
795
+ /**
796
+ * Function that is invoked when the `WebView` load fails.
797
+ */
798
+ onError?: (event: WebViewErrorEvent) => void;
799
+ /**
800
+ * Function that is invoked when the `WebView` receives an error status code.
801
+ * Works on iOS and Android (minimum API level 23).
802
+ */
803
+ onHttpError?: (event: WebViewHttpErrorEvent) => void;
804
+ /**
805
+ * Function that is invoked when the `WebView` loading starts or ends.
806
+ */
807
+ onNavigationStateChange?: (event: WebViewNavigation) => void;
808
+ /**
809
+ * Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`.
810
+ * Setting this property will inject this global into your webview.
811
+ *
812
+ * `window.ReactNativeWebView.postMessage` accepts one argument, `data`, which will be
813
+ * available on the event object, `event.nativeEvent.data`. `data` must be a string.
814
+ */
815
+ onMessage?: (event: WebViewMessageEvent) => void;
816
+ /**
817
+ * Function that is invoked when the `WebView` is loading.
818
+ */
819
+ onLoadProgress?: (event: WebViewProgressEvent) => void;
820
+ /**
821
+ * Boolean value that forces the `WebView` to show the loading view
822
+ * on the first load.
823
+ */
824
+ startInLoadingState?: boolean;
825
+ /**
826
+ * Set this to provide JavaScript that will be injected into the web page
827
+ * when the view loads.
828
+ */
829
+ injectedJavaScript?: string;
830
+ /**
831
+ * Set this to provide JavaScript that will be injected into the web page
832
+ * once the webview is initialized but before the view loads any content.
833
+ */
834
+ injectedJavaScriptBeforeContentLoaded?: string;
835
+ /**
836
+ * If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
837
+ * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
838
+ */
839
+ injectedJavaScriptForMainFrameOnly?: boolean;
840
+ /**
841
+ * If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
842
+ * If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
843
+ */
844
+ injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
845
+ /**
846
+ * Boolean value that determines whether a horizontal scroll indicator is
847
+ * shown in the `WebView`. The default value is `true`.
848
+ */
849
+ showsHorizontalScrollIndicator?: boolean;
850
+ /**
851
+ * Boolean value that determines whether a vertical scroll indicator is
852
+ * shown in the `WebView`. The default value is `true`.
853
+ */
854
+ showsVerticalScrollIndicator?: boolean;
855
+ /**
856
+ * Boolean that determines whether HTML5 audio and video requires the user
857
+ * to tap them before they start playing. The default value is `true`.
858
+ */
859
+ mediaPlaybackRequiresUserAction?: boolean;
860
+ /**
861
+ * List of origin strings to allow being navigated to. The strings allow
862
+ * wildcards and get matched against *just* the origin (not the full URL).
863
+ * If the user taps to navigate to a new page but the new page is not in
864
+ * this whitelist, we will open the URL in Safari.
865
+ * The default whitelisted origins are "http://*" and "https://*".
866
+ */
867
+ readonly originWhitelist?: string[];
868
+ /**
869
+ * Function that allows custom handling of any web view requests. Return
870
+ * `true` from the function to continue loading the request and `false`
871
+ * to stop loading. The `navigationType` is always `other` on android.
872
+ */
873
+ onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest;
874
+ /**
875
+ * Override the native component used to render the WebView. Enables a custom native
876
+ * WebView which uses the same JavaScript as the original WebView.
877
+ */
878
+ nativeConfig?: WebViewNativeConfig;
879
+ /**
880
+ * Should caching be enabled. Default is true.
881
+ */
882
+ cacheEnabled?: boolean;
883
+ /**
884
+ * Append to the existing user-agent. Overridden if `userAgent` is set.
885
+ */
886
+ applicationNameForUserAgent?: string;
887
+ /**
888
+ * An object that specifies the credentials of a user to be used for basic authentication.
889
+ */
890
+ basicAuthCredential?: BasicAuthCredential;
891
+ }
892
+ export {};
893
+ //# sourceMappingURL=WebViewTypes.d.ts.map