@exodus/react-native-webview 9.4.0-no-android.0 → 11.26.1-exodus.1

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