@exodus/react-native-webview 11.26.1-exodus.27 → 11.26.1-exodus.28

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