@exodus/react-native-webview 11.26.1-exodus.2 → 11.26.1-exodus.20

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.
@@ -1,4 +1,4 @@
1
- import { ReactElement, Component } from 'react';
1
+ import { ReactElement, Component, ElementType } from 'react';
2
2
  import { NativeSyntheticEvent, ViewProps, StyleProp, ViewStyle, NativeMethodsMixin, Constructor, UIManagerStatic, NativeScrollEvent } from 'react-native';
3
3
  declare type WebViewCommands = 'goForward' | 'goBack' | 'reload' | 'stopLoading' | 'postMessage' | 'injectJavaScript' | 'loadUrl' | 'requestFocus';
4
4
  declare type AndroidWebViewCommands = 'clearHistory' | 'clearCache' | 'clearFormData';
@@ -48,6 +48,9 @@ export interface WebViewNativeEvent {
48
48
  canGoForward: boolean;
49
49
  lockIdentifier: number;
50
50
  }
51
+ export declare type WebViewOpenWindowEvent = Readonly<{
52
+ targetUrl: string;
53
+ }>;
51
54
  export interface WebViewNativeProgressEvent extends WebViewNativeEvent {
52
55
  progress: number;
53
56
  }
@@ -58,9 +61,6 @@ export interface WebViewNavigation extends WebViewNativeEvent {
58
61
  export interface ShouldStartLoadRequest extends WebViewNavigation {
59
62
  isTopFrame: boolean;
60
63
  }
61
- export interface FileDownload {
62
- downloadUrl: string;
63
- }
64
64
  export declare type DecelerationRateConstant = 'normal' | 'fast';
65
65
  export interface WebViewMessage extends WebViewNativeEvent {
66
66
  data: string;
@@ -73,23 +73,12 @@ export interface WebViewError extends WebViewNativeEvent {
73
73
  code: number;
74
74
  description: string;
75
75
  }
76
- export interface WebViewHttpError extends WebViewNativeEvent {
77
- description: string;
78
- statusCode: number;
79
- }
80
- export interface WebViewRenderProcessGoneDetail {
81
- didCrash: boolean;
82
- }
83
76
  export declare type WebViewEvent = NativeSyntheticEvent<WebViewNativeEvent>;
84
77
  export declare type WebViewProgressEvent = NativeSyntheticEvent<WebViewNativeProgressEvent>;
85
78
  export declare type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
86
79
  export declare type ShouldStartLoadRequestEvent = NativeSyntheticEvent<ShouldStartLoadRequest>;
87
- export declare type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
88
80
  export declare type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
89
81
  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
82
  export declare type WebViewScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
94
83
  export declare type DataDetectorTypes = 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'trackingNumber' | 'flightNumber' | 'lookupSuggestion' | 'none' | 'all';
95
84
  export declare type OverScrollModeType = 'always' | 'content' | 'never';
@@ -155,22 +144,20 @@ export interface BasicAuthCredential {
155
144
  password: string;
156
145
  }
157
146
  export interface CommonNativeWebViewProps extends ViewProps {
158
- allowFileAccessFromFileURLs?: boolean;
159
147
  cacheEnabled?: boolean;
160
148
  incognito?: boolean;
161
149
  injectedJavaScript?: string;
162
150
  injectedJavaScriptBeforeContentLoaded?: string;
163
- injectedJavaScriptForMainFrameOnly?: boolean;
164
- injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
165
151
  mediaPlaybackRequiresUserAction?: boolean;
152
+ webviewDebuggingEnabled?: boolean;
166
153
  messagingEnabled: boolean;
167
154
  onScroll?: (event: WebViewScrollEvent) => void;
168
155
  onLoadingError: (event: WebViewErrorEvent) => void;
169
156
  onLoadingFinish: (event: WebViewNavigationEvent) => void;
170
157
  onLoadingProgress: (event: WebViewProgressEvent) => void;
171
158
  onLoadingStart: (event: WebViewNavigationEvent) => void;
172
- onHttpError: (event: WebViewHttpErrorEvent) => void;
173
159
  onMessage: (event: WebViewMessageEvent) => void;
160
+ onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
174
161
  onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
175
162
  showsHorizontalScrollIndicator?: boolean;
176
163
  showsVerticalScrollIndicator?: boolean;
@@ -179,15 +166,11 @@ export interface CommonNativeWebViewProps extends ViewProps {
179
166
  /**
180
167
  * Append to the existing user-agent. Overridden if `userAgent` is set.
181
168
  */
182
- applicationNameForUserAgent?: string;
183
169
  basicAuthCredential?: BasicAuthCredential;
184
170
  }
185
171
  export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
186
172
  cacheMode?: CacheMode;
187
- allowFileAccess?: boolean;
188
173
  scalesPageToFit?: boolean;
189
- allowsFullscreenVideo?: boolean;
190
- allowUniversalAccessFromFileURLs?: boolean;
191
174
  androidHardwareAccelerationDisabled?: boolean;
192
175
  androidLayerType?: AndroidLayerType;
193
176
  domStorageEnabled?: boolean;
@@ -195,7 +178,6 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
195
178
  javaScriptEnabled?: boolean;
196
179
  mixedContentMode?: 'never' | 'always' | 'compatibility';
197
180
  onContentSizeChange?: (event: WebViewEvent) => void;
198
- onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
199
181
  overScrollMode?: OverScrollModeType;
200
182
  saveFormDataDisabled?: boolean;
201
183
  setSupportMultipleWindows?: boolean;
@@ -216,12 +198,9 @@ export declare type ContentInsetAdjustmentBehavior = 'automatic' | 'scrollableAx
216
198
  export declare type MediaCapturePermissionGrantType = 'grantIfSameHostElsePrompt' | 'grantIfSameHostElseDeny' | 'deny' | 'grant' | 'prompt';
217
199
  export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
218
200
  export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
219
- allowingReadAccessToURL?: string;
220
201
  allowsBackForwardNavigationGestures?: boolean;
221
202
  allowsInlineMediaPlayback?: boolean;
222
- allowsAirPlayForMediaPlayback?: boolean;
223
203
  allowsLinkPreview?: boolean;
224
- allowUniversalAccessFromFileURLs?: boolean;
225
204
  automaticallyAdjustContentInsets?: boolean;
226
205
  autoManageStatusBarEnabled?: boolean;
227
206
  bounces?: boolean;
@@ -236,10 +215,6 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
236
215
  pagingEnabled?: boolean;
237
216
  scrollEnabled?: boolean;
238
217
  useSharedProcessPool?: boolean;
239
- onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
240
- injectedJavaScriptForMainFrameOnly?: boolean;
241
- injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
242
- onFileDownload?: (event: FileDownloadEvent) => void;
243
218
  limitsNavigationsToAppBoundDomains?: boolean;
244
219
  sharedCookiesEnabled?: boolean;
245
220
  enableApplePay?: boolean;
@@ -352,11 +327,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
352
327
  * @platform ios
353
328
  */
354
329
  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
330
  /**
361
331
  * Hide the accessory view when the keyboard is open. Default is false to be
362
332
  * backward compatible.
@@ -393,12 +363,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
393
363
  * @platform ios
394
364
  */
395
365
  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
366
  /**
403
367
  * Set true if StatusBar should be light when user watch video fullscreen.
404
368
  * The default value is `true`.
@@ -423,47 +387,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
423
387
  * @platform ios
424
388
  */
425
389
  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
390
  /**
468
391
  * Boolean value that determines whether a pull to refresh gesture is
469
392
  * available in the `WebView`. The default value is `false`.
@@ -472,23 +395,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
472
395
  *
473
396
  */
474
397
  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
398
  /**
493
399
  * A Boolean value which, when set to `true`, indicates to WebKit that a WKWebView
494
400
  * will only navigate to app-bound domains. Once set, any attempt to navigate away
@@ -543,13 +449,16 @@ export interface IOSWebViewProps extends WebViewSharedProps {
543
449
  onCustomMenuSelection?: (event: WebViewEvent) => void;
544
450
  }
545
451
  export interface AndroidWebViewProps extends WebViewSharedProps {
546
- onNavigationStateChange?: (event: WebViewNavigation) => void;
547
452
  onContentSizeChange?: (event: WebViewEvent) => void;
548
453
  /**
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).
454
+ * Function that is invoked when the `WebView` should open a new window.
455
+ *
456
+ * This happens when the JS calls `window.open('http://someurl', '_blank')`
457
+ * or when the user clicks on a `<a href="http://someurl" target="_blank">` link.
458
+ *
459
+ * @platform android
551
460
  */
552
- onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void;
461
+ onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
553
462
  /**
554
463
  * https://developer.android.com/reference/android/webkit/WebSettings.html#setCacheMode(int)
555
464
  * Set the cacheMode. Possible values are:
@@ -584,25 +493,6 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
584
493
  * @platform android
585
494
  */
586
495
  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
496
  /**
607
497
  * Used on Android only, controls whether form autocomplete data should be saved
608
498
  * @platform android
@@ -673,10 +563,6 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
673
563
  * @platform android
674
564
  */
675
565
  mixedContentMode?: 'never' | 'always' | 'compatibility';
676
- /**
677
- * Sets ability to open fullscreen videos on Android devices.
678
- */
679
- allowsFullscreenVideo?: boolean;
680
566
  /**
681
567
  * Configuring Dark Theme
682
568
  *
@@ -781,15 +667,6 @@ export interface WebViewSharedProps extends ViewProps {
781
667
  * Function that is invoked when the `WebView` load fails.
782
668
  */
783
669
  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
670
  /**
794
671
  * Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`.
795
672
  * Setting this property will inject this global into your webview.
@@ -797,11 +674,7 @@ export interface WebViewSharedProps extends ViewProps {
797
674
  * `window.ReactNativeWebView.postMessage` accepts one argument, `data`, which will be
798
675
  * available on the event object, `event.nativeEvent.data`. `data` must be a string.
799
676
  */
800
- onMessage?: (event: WebViewMessageEvent) => void;
801
- /**
802
- * Function that is invoked when the `WebView` is loading.
803
- */
804
- onLoadProgress?: (event: WebViewProgressEvent) => void;
677
+ onMessage?: (event: WebViewMessage) => void;
805
678
  /**
806
679
  * Boolean value that forces the `WebView` to show the loading view
807
680
  * on the first load.
@@ -817,16 +690,6 @@ export interface WebViewSharedProps extends ViewProps {
817
690
  * once the webview is initialized but before the view loads any content.
818
691
  */
819
692
  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
693
  /**
831
694
  * Boolean value that determines whether a horizontal scroll indicator is
832
695
  * shown in the `WebView`. The default value is `true`.
@@ -860,14 +723,34 @@ export interface WebViewSharedProps extends ViewProps {
860
723
  * Should caching be enabled. Default is true.
861
724
  */
862
725
  cacheEnabled?: boolean;
863
- /**
864
- * Append to the existing user-agent. Overridden if `userAgent` is set.
865
- */
866
- applicationNameForUserAgent?: string;
867
726
  /**
868
727
  * An object that specifies the credentials of a user to be used for basic authentication.
869
728
  */
870
729
  basicAuthCredential?: BasicAuthCredential;
730
+ /**
731
+ * Enables WebView remote debugging using Chrome (Android) or Safari (iOS).
732
+ */
733
+ webviewDebuggingEnabled?: boolean;
734
+ /**
735
+ * Event metadata validation.
736
+ */
737
+ validateMeta: (event: WebViewNativeEvent) => WebViewNativeEvent;
738
+ /**
739
+ * Event data validation.
740
+ */
741
+ validateData: (data: object) => object;
742
+ /**
743
+ * Webview will refuse to work on iOS versions below this one. Required for iOS.
744
+ */
745
+ minimumIOSVersion?: string;
746
+ /**
747
+ * Webview will refuse to work on Chrome versions below this one. Required for Android.
748
+ */
749
+ minimumChromeVersion?: string;
750
+ /**
751
+ * Component to render if the OS version is not supported.
752
+ */
753
+ unsupportedVersionComponent?: ElementType;
871
754
  }
872
755
  export {};
873
756
  //# sourceMappingURL=WebViewTypes.d.ts.map
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "Thibault Malbranche <malbranche.thibault@gmail.com>"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "11.26.1-exodus.2",
12
+ "version": "11.26.1-exodus.20",
13
13
  "homepage": "https://github.com/ExodusMovement/react-native-webview#readme",
14
14
  "scripts": {
15
15
  "android": "react-native run-android",
@@ -1,15 +0,0 @@
1
- package com.reactnativecommunity.webview
2
-
3
- import com.facebook.react.ReactPackage
4
- import com.facebook.react.bridge.ReactApplicationContext
5
-
6
-
7
- class RNCWebViewPackage: ReactPackage {
8
- override fun createNativeModules(reactContext: ReactApplicationContext) = listOf(
9
- RNCWebViewModule(reactContext)
10
- )
11
-
12
- override fun createViewManagers(reactContext: ReactApplicationContext) = listOf(
13
- RNCWebViewManager()
14
- )
15
- }
@@ -1,26 +0,0 @@
1
- package com.reactnativecommunity.webview.events
2
-
3
- import com.facebook.react.bridge.WritableMap
4
- import com.facebook.react.uimanager.events.Event
5
- import com.facebook.react.uimanager.events.RCTEventEmitter
6
-
7
- /**
8
- * Event emitted when the WebView's process has crashed or
9
- was killed by the OS.
10
- */
11
- class TopRenderProcessGoneEvent(viewId: Int, private val mEventData: WritableMap) :
12
- Event<TopRenderProcessGoneEvent>(viewId) {
13
- companion object {
14
- const val EVENT_NAME = "topRenderProcessGone"
15
- }
16
-
17
- override fun getEventName(): String = EVENT_NAME
18
-
19
- override fun canCoalesce(): Boolean = false
20
-
21
- override fun getCoalescingKey(): Short = 0
22
-
23
- override fun dispatch(rctEventEmitter: RCTEventEmitter) =
24
- rctEventEmitter.receiveEvent(viewTag, eventName, mEventData)
25
-
26
- }