@javascriptcommon/react-native-webview 13.12.16

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