@exodus/react-native-webview 13.16.0-exodus.3 → 13.16.0-exodus.5
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.
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +15 -18
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java +0 -7
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java +0 -21
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt +5 -50
- package/android/src/newarch/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -58
- package/android/src/oldarch/com/reactnativecommunity/webview/RNCWebViewManager.java +0 -40
- package/apple/RNCWebView.mm +0 -39
- package/apple/RNCWebViewDecisionManager.m +17 -0
- package/apple/RNCWebViewImpl.h +0 -10
- package/apple/RNCWebViewImpl.m +24 -72
- package/apple/RNCWebViewManager.mm +0 -11
- package/lib/RNCWebViewNativeComponent.d.ts +0 -26
- package/lib/RNCWebViewNativeComponent.js +1 -1
- package/lib/WebView.android.js +1 -1
- package/lib/WebView.d.ts +2 -2
- package/lib/WebView.ios.js +1 -1
- package/lib/WebView.js +1 -1
- package/lib/WebViewShared.d.ts +5 -5
- package/lib/WebViewShared.js +1 -1
- package/lib/WebViewTypes.d.ts +5 -358
- package/lib/WebViewTypes.js +1 -1
- package/package.json +6 -12
- package/react-native-webview.podspec +1 -1
- package/src/RNCWebViewNativeComponent.ts +0 -37
- package/src/WebView.android.tsx +293 -284
- package/src/WebView.ios.tsx +223 -256
- package/src/WebView.tsx +2 -8
- package/src/WebViewShared.tsx +2 -11
- package/src/WebViewTypes.ts +2 -396
- package/android/src/main/java/com/reactnativecommunity/webview/events/TopHttpErrorEvent.kt +0 -25
- package/lib/WebView.macos.d.ts +0 -6
- package/lib/WebView.macos.js +0 -1
- package/lib/WebView.windows.d.ts +0 -17
- package/lib/WebView.windows.js +0 -1
- package/lib/WebViewNativeComponent.windows.d.ts +0 -3
- package/lib/WebViewNativeComponent.windows.js +0 -1
- package/src/WebView.macos.tsx +0 -252
- package/src/WebView.windows.tsx +0 -217
- package/src/WebViewNativeComponent.macos.ts +0 -7
- package/src/WebViewNativeComponent.windows.ts +0 -8
- package/src/__tests__/WebViewShared-test.js +0 -323
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +0 -8
- package/src/__tests__/validation-test.js +0 -38
package/src/WebViewTypes.ts
CHANGED
|
@@ -17,7 +17,6 @@ type WebViewCommands =
|
|
|
17
17
|
| 'reload'
|
|
18
18
|
| 'stopLoading'
|
|
19
19
|
| 'postMessage'
|
|
20
|
-
| 'injectJavaScript'
|
|
21
20
|
| 'loadUrl'
|
|
22
21
|
| 'requestFocus'
|
|
23
22
|
| 'clearCache';
|
|
@@ -34,8 +33,6 @@ export type RNCWebViewUIManagerAndroid = RNCWebViewUIManager<
|
|
|
34
33
|
WebViewCommands | AndroidWebViewCommands
|
|
35
34
|
>;
|
|
36
35
|
export type RNCWebViewUIManagerIOS = RNCWebViewUIManager<WebViewCommands>;
|
|
37
|
-
export type RNCWebViewUIManagerMacOS = RNCWebViewUIManager<WebViewCommands>;
|
|
38
|
-
export type RNCWebViewUIManagerWindows = RNCWebViewUIManager<WebViewCommands>;
|
|
39
36
|
|
|
40
37
|
type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
|
|
41
38
|
|
|
@@ -57,16 +54,6 @@ export type State = NormalState | ErrorState;
|
|
|
57
54
|
|
|
58
55
|
type Constructor<T> = new (...args: any[]) => T;
|
|
59
56
|
|
|
60
|
-
declare class NativeWebViewMacOSComponent extends Component<MacOSNativeWebViewProps> {}
|
|
61
|
-
declare const NativeWebViewMacOSBase: Constructor<NativeMethodsMixin> &
|
|
62
|
-
typeof NativeWebViewMacOSComponent;
|
|
63
|
-
export class NativeWebViewMacOS extends NativeWebViewMacOSBase {}
|
|
64
|
-
|
|
65
|
-
declare class NativeWebViewWindowsComponent extends Component<WindowsNativeWebViewProps> {}
|
|
66
|
-
declare const NativeWebViewWindowsBase: Constructor<NativeMethodsMixin> &
|
|
67
|
-
typeof NativeWebViewWindowsComponent;
|
|
68
|
-
export class NativeWebViewWindows extends NativeWebViewWindowsBase {}
|
|
69
|
-
|
|
70
57
|
export interface ContentInsetProp {
|
|
71
58
|
top?: number;
|
|
72
59
|
left?: number;
|
|
@@ -102,10 +89,6 @@ export interface ShouldStartLoadRequest extends WebViewNavigation {
|
|
|
102
89
|
isTopFrame: boolean;
|
|
103
90
|
}
|
|
104
91
|
|
|
105
|
-
export interface FileDownload {
|
|
106
|
-
downloadUrl: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
92
|
export type DecelerationRateConstant = 'normal' | 'fast';
|
|
110
93
|
|
|
111
94
|
export interface WebViewMessage extends WebViewNativeEvent {
|
|
@@ -114,18 +97,13 @@ export interface WebViewMessage extends WebViewNativeEvent {
|
|
|
114
97
|
|
|
115
98
|
export interface WebViewError extends WebViewNativeEvent {
|
|
116
99
|
/**
|
|
117
|
-
* `domain` is only used on iOS
|
|
100
|
+
* `domain` is only used on iOS
|
|
118
101
|
*/
|
|
119
102
|
domain?: string;
|
|
120
103
|
code: number;
|
|
121
104
|
description: string;
|
|
122
105
|
}
|
|
123
106
|
|
|
124
|
-
export interface WebViewHttpError extends WebViewNativeEvent {
|
|
125
|
-
description: string;
|
|
126
|
-
statusCode: number;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
107
|
export interface WebViewRenderProcessGoneDetail {
|
|
130
108
|
didCrash: boolean;
|
|
131
109
|
}
|
|
@@ -144,16 +122,12 @@ export type WebViewNavigationEvent = NativeSyntheticEvent<WebViewNavigation>;
|
|
|
144
122
|
export type ShouldStartLoadRequestEvent =
|
|
145
123
|
NativeSyntheticEvent<ShouldStartLoadRequest>;
|
|
146
124
|
|
|
147
|
-
export type FileDownloadEvent = NativeSyntheticEvent<FileDownload>;
|
|
148
|
-
|
|
149
125
|
export type WebViewMessageEvent = NativeSyntheticEvent<WebViewMessage>;
|
|
150
126
|
|
|
151
127
|
export type WebViewErrorEvent = NativeSyntheticEvent<WebViewError>;
|
|
152
128
|
|
|
153
129
|
export type WebViewTerminatedEvent = NativeSyntheticEvent<WebViewNativeEvent>;
|
|
154
130
|
|
|
155
|
-
export type WebViewHttpErrorEvent = NativeSyntheticEvent<WebViewHttpError>;
|
|
156
|
-
|
|
157
131
|
export type WebViewRenderProcessGoneEvent =
|
|
158
132
|
NativeSyntheticEvent<WebViewRenderProcessGoneDetail>;
|
|
159
133
|
|
|
@@ -254,23 +228,6 @@ export interface ViewManager {
|
|
|
254
228
|
shouldStartLoadWithLockIdentifier: Function;
|
|
255
229
|
}
|
|
256
230
|
|
|
257
|
-
export interface WebViewNativeConfig {
|
|
258
|
-
/**
|
|
259
|
-
* The native component used to render the WebView.
|
|
260
|
-
*/
|
|
261
|
-
component?: typeof NativeWebViewMacOS | typeof NativeWebViewComponent;
|
|
262
|
-
/**
|
|
263
|
-
* Set props directly on the native component WebView. Enables custom props which the
|
|
264
|
-
* original WebView doesn't pass through.
|
|
265
|
-
*/
|
|
266
|
-
props?: Object;
|
|
267
|
-
/**
|
|
268
|
-
* Set the ViewManager to use for communication with the native side.
|
|
269
|
-
* @platform ios, macos
|
|
270
|
-
*/
|
|
271
|
-
viewManager?: ViewManager;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
231
|
export type OnShouldStartLoadWithRequest = (
|
|
275
232
|
event: ShouldStartLoadRequest
|
|
276
233
|
) => boolean;
|
|
@@ -292,9 +249,6 @@ export interface CommonNativeWebViewProps extends ViewProps {
|
|
|
292
249
|
incognito?: boolean;
|
|
293
250
|
injectedJavaScript?: string;
|
|
294
251
|
injectedJavaScriptBeforeContentLoaded?: string;
|
|
295
|
-
injectedJavaScriptForMainFrameOnly?: boolean;
|
|
296
|
-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
|
|
297
|
-
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
298
252
|
mediaPlaybackRequiresUserAction?: boolean;
|
|
299
253
|
webviewDebuggingEnabled?: boolean;
|
|
300
254
|
messagingEnabled: boolean;
|
|
@@ -308,7 +262,6 @@ export interface CommonNativeWebViewProps extends ViewProps {
|
|
|
308
262
|
onLoadingFinish: (event: WebViewNavigationEvent) => void;
|
|
309
263
|
onLoadingProgress: (event: WebViewProgressEvent) => void;
|
|
310
264
|
onLoadingStart: (event: WebViewNavigationEvent) => void;
|
|
311
|
-
onHttpError: (event: WebViewHttpErrorEvent) => void;
|
|
312
265
|
onMessage: (event: WebViewMessageEvent) => void;
|
|
313
266
|
onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void;
|
|
314
267
|
showsHorizontalScrollIndicator?: boolean;
|
|
@@ -318,10 +271,6 @@ export interface CommonNativeWebViewProps extends ViewProps {
|
|
|
318
271
|
|
|
319
272
|
source: any;
|
|
320
273
|
userAgent?: string;
|
|
321
|
-
/**
|
|
322
|
-
* Append to the existing user-agent. Overridden if `userAgent` is set.
|
|
323
|
-
*/
|
|
324
|
-
applicationNameForUserAgent?: string;
|
|
325
274
|
basicAuthCredential?: BasicAuthCredential;
|
|
326
275
|
}
|
|
327
276
|
|
|
@@ -340,63 +289,6 @@ export declare type MediaCapturePermissionGrantType =
|
|
|
340
289
|
|
|
341
290
|
export declare type ContentMode = 'recommended' | 'mobile' | 'desktop';
|
|
342
291
|
|
|
343
|
-
export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
|
|
344
|
-
allowingReadAccessToURL?: string;
|
|
345
|
-
allowFileAccessFromFileURLs?: boolean;
|
|
346
|
-
allowUniversalAccessFromFileURLs?: boolean;
|
|
347
|
-
allowsBackForwardNavigationGestures?: boolean;
|
|
348
|
-
allowsInlineMediaPlayback?: boolean;
|
|
349
|
-
allowsPictureInPictureMediaPlayback?: boolean;
|
|
350
|
-
allowsAirPlayForMediaPlayback?: boolean;
|
|
351
|
-
allowsLinkPreview?: boolean;
|
|
352
|
-
automaticallyAdjustContentInsets?: boolean;
|
|
353
|
-
bounces?: boolean;
|
|
354
|
-
contentInset?: ContentInsetProp;
|
|
355
|
-
contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
|
|
356
|
-
directionalLockEnabled?: boolean;
|
|
357
|
-
hideKeyboardAccessoryView?: boolean;
|
|
358
|
-
javaScriptEnabled?: boolean;
|
|
359
|
-
pagingEnabled?: boolean;
|
|
360
|
-
scrollEnabled?: boolean;
|
|
361
|
-
useSharedProcessPool?: boolean;
|
|
362
|
-
onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export interface WindowsNativeWebViewProps extends CommonNativeWebViewProps {
|
|
366
|
-
testID?: string;
|
|
367
|
-
linkHandlingEnabled?: boolean;
|
|
368
|
-
onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
|
|
369
|
-
onSourceChanged?: (event: WebViewNavigationEvent) => void;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export interface WindowsWebViewProps extends WebViewSharedProps {
|
|
373
|
-
/**
|
|
374
|
-
* Boolean value that detenmines whether the web view should use the new chromium based edge webview.
|
|
375
|
-
*/
|
|
376
|
-
useWebView2?: boolean;
|
|
377
|
-
/**
|
|
378
|
-
* Function that is invoked when the `WebView` should open a new window.
|
|
379
|
-
*
|
|
380
|
-
* This happens when the JS calls `window.open('http://someurl', '_blank')`
|
|
381
|
-
* or when the user clicks on a `<a href="http://someurl" target="_blank">` link.
|
|
382
|
-
*
|
|
383
|
-
* Only works with `useWebView2` set to `true`.
|
|
384
|
-
*
|
|
385
|
-
* @platform windows
|
|
386
|
-
*/
|
|
387
|
-
onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Function that is invoked when the `WebView` responds to a request to load a new resource.
|
|
391
|
-
* Works only on Windows.
|
|
392
|
-
*
|
|
393
|
-
* Only works with `useWebView2` set to `true`.
|
|
394
|
-
*
|
|
395
|
-
* @platform windows
|
|
396
|
-
*/
|
|
397
|
-
onSourceChanged?: (event: WebViewNavigationEvent) => void;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
292
|
export interface IOSWebViewProps extends WebViewSharedProps {
|
|
401
293
|
/**
|
|
402
294
|
* Does not store any data within the lifetime of the WebView.
|
|
@@ -518,14 +410,9 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|
|
518
410
|
* Boolean value that indicates whether HTML5 videos can play Picture in Picture.
|
|
519
411
|
* The default value is `true`.
|
|
520
412
|
*
|
|
521
|
-
* @platform macos
|
|
522
|
-
*/
|
|
523
|
-
allowsPictureInPictureMediaPlayback?: boolean;
|
|
524
|
-
/**
|
|
525
|
-
* A Boolean value indicating whether AirPlay is allowed. The default value is `false`.
|
|
526
413
|
* @platform ios
|
|
527
414
|
*/
|
|
528
|
-
|
|
415
|
+
allowsPictureInPictureMediaPlayback?: boolean;
|
|
529
416
|
/**
|
|
530
417
|
* Hide the accessory view when the keyboard is open. Default is false to be
|
|
531
418
|
* backward compatible.
|
|
@@ -601,33 +488,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|
|
601
488
|
*/
|
|
602
489
|
keyboardDisplayRequiresUserAction?: boolean;
|
|
603
490
|
|
|
604
|
-
/**
|
|
605
|
-
* A String value that indicates which URLs the WebView's file can then
|
|
606
|
-
* reference in scripts, AJAX requests, and CSS imports. This is only used
|
|
607
|
-
* for WebViews that are loaded with a source.uri set to a `'file://'` URL.
|
|
608
|
-
*
|
|
609
|
-
* If not provided, the default is to only allow read access to the URL
|
|
610
|
-
* provided in source.uri itself.
|
|
611
|
-
* @platform ios
|
|
612
|
-
*/
|
|
613
|
-
allowingReadAccessToURL?: string;
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Boolean that sets whether JavaScript running in the context of a file
|
|
617
|
-
* scheme URL should be allowed to access content from other file scheme URLs.
|
|
618
|
-
* Including accessing content from other file scheme URLs
|
|
619
|
-
* @platform ios
|
|
620
|
-
*/
|
|
621
|
-
allowFileAccessFromFileURLs?: boolean;
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Boolean that sets whether JavaScript running in the context of a file
|
|
625
|
-
* scheme URL should be allowed to access content from any origin.
|
|
626
|
-
* Including accessing content from other file scheme URLs
|
|
627
|
-
* @platform ios
|
|
628
|
-
*/
|
|
629
|
-
allowUniversalAccessFromFileURLs?: boolean;
|
|
630
|
-
|
|
631
491
|
/**
|
|
632
492
|
* Function that is invoked when the WebKit WebView content process gets terminated.
|
|
633
493
|
* @platform ios
|
|
@@ -644,20 +504,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|
|
644
504
|
*/
|
|
645
505
|
onOpenWindow?: (event: WebViewOpenWindowEvent) => void;
|
|
646
506
|
|
|
647
|
-
/**
|
|
648
|
-
* If `true` (default), loads the `injectedJavaScript` only into the main frame.
|
|
649
|
-
* If `false`, loads it into all frames (e.g. iframes).
|
|
650
|
-
* @platform ios
|
|
651
|
-
*/
|
|
652
|
-
injectedJavaScriptForMainFrameOnly?: boolean;
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* If `true` (default), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
|
|
656
|
-
* If `false`, loads it into all frames (e.g. iframes).
|
|
657
|
-
* @platform ios
|
|
658
|
-
*/
|
|
659
|
-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
|
|
660
|
-
|
|
661
507
|
/**
|
|
662
508
|
* Boolean value that determines whether a pull to refresh gesture is
|
|
663
509
|
* available in the `WebView`. The default value is `false`.
|
|
@@ -688,24 +534,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|
|
688
534
|
*/
|
|
689
535
|
indicatorStyle?: IndicatorStyleType;
|
|
690
536
|
|
|
691
|
-
/**
|
|
692
|
-
* Function that is invoked when the client needs to download a file.
|
|
693
|
-
*
|
|
694
|
-
* iOS 13+ only: If the webview navigates to a URL that results in an HTTP
|
|
695
|
-
* response with a Content-Disposition header 'attachment...', then
|
|
696
|
-
* this will be called.
|
|
697
|
-
*
|
|
698
|
-
* iOS 8+: If the MIME type indicates that the content is not renderable by the
|
|
699
|
-
* webview, that will also cause this to be called. On iOS versions before 13,
|
|
700
|
-
* this is the only condition that will cause this function to be called.
|
|
701
|
-
*
|
|
702
|
-
* The application will need to provide its own code to actually download
|
|
703
|
-
* the file.
|
|
704
|
-
*
|
|
705
|
-
* If not provided, the default is to let the webview try to render the file.
|
|
706
|
-
*/
|
|
707
|
-
onFileDownload?: (event: FileDownloadEvent) => void;
|
|
708
|
-
|
|
709
537
|
/**
|
|
710
538
|
* A Boolean value which, when set to `true`, indicates to WebKit that a WKWebView
|
|
711
539
|
* will only navigate to app-bound domains. Once set, any attempt to navigate away
|
|
@@ -799,171 +627,6 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|
|
799
627
|
unsupportedVersionComponent?: ElementType;
|
|
800
628
|
}
|
|
801
629
|
|
|
802
|
-
export interface MacOSWebViewProps extends WebViewSharedProps {
|
|
803
|
-
/**
|
|
804
|
-
* Does not store any data within the lifetime of the WebView.
|
|
805
|
-
*/
|
|
806
|
-
incognito?: boolean;
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
* Boolean value that determines whether the web view bounces
|
|
810
|
-
* when it reaches the edge of the content. The default value is `true`.
|
|
811
|
-
* @platform macos
|
|
812
|
-
*/
|
|
813
|
-
bounces?: boolean;
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* Boolean value that determines whether scrolling is enabled in the
|
|
817
|
-
* `WebView`. The default value is `true`.
|
|
818
|
-
* @platform macos
|
|
819
|
-
*/
|
|
820
|
-
scrollEnabled?: boolean;
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* If the value of this property is true, the scroll view stops on multiples
|
|
824
|
-
* of the scroll view's bounds when the user scrolls.
|
|
825
|
-
* The default value is false.
|
|
826
|
-
* @platform macos
|
|
827
|
-
*/
|
|
828
|
-
pagingEnabled?: boolean;
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* Controls whether to adjust the content inset for web views that are
|
|
832
|
-
* placed behind a navigation bar, tab bar, or toolbar. The default value
|
|
833
|
-
* is `true`.
|
|
834
|
-
* @platform macos
|
|
835
|
-
*/
|
|
836
|
-
automaticallyAdjustContentInsets?: boolean;
|
|
837
|
-
|
|
838
|
-
/**
|
|
839
|
-
* This property specifies how the safe area insets are used to modify the
|
|
840
|
-
* content area of the scroll view. The default value of this property is
|
|
841
|
-
* "never". Available on iOS 11 and later.
|
|
842
|
-
*/
|
|
843
|
-
contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior;
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* The amount by which the web view content is inset from the edges of
|
|
847
|
-
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
|
|
848
|
-
* @platform macos
|
|
849
|
-
*/
|
|
850
|
-
contentInset?: ContentInsetProp;
|
|
851
|
-
|
|
852
|
-
/**
|
|
853
|
-
* Boolean that determines whether HTML5 videos play inline or use the
|
|
854
|
-
* native full-screen controller. The default value is `false`.
|
|
855
|
-
*
|
|
856
|
-
* **NOTE** : In order for video to play inline, not only does this
|
|
857
|
-
* property need to be set to `true`, but the video element in the HTML
|
|
858
|
-
* document must also include the `webkit-playsinline` attribute.
|
|
859
|
-
* @platform macos
|
|
860
|
-
*/
|
|
861
|
-
allowsInlineMediaPlayback?: boolean;
|
|
862
|
-
/**
|
|
863
|
-
* Boolean value that indicates whether HTML5 videos can play Picture in Picture.
|
|
864
|
-
* The default value is `true`.
|
|
865
|
-
*
|
|
866
|
-
* @platform ios
|
|
867
|
-
*/
|
|
868
|
-
allowsPictureInPictureMediaPlayback?: boolean;
|
|
869
|
-
/**
|
|
870
|
-
* A Boolean value indicating whether AirPlay is allowed. The default value is `false`.
|
|
871
|
-
* @platform macos
|
|
872
|
-
*/
|
|
873
|
-
allowsAirPlayForMediaPlayback?: boolean;
|
|
874
|
-
/**
|
|
875
|
-
* Hide the accessory view when the keyboard is open. Default is false to be
|
|
876
|
-
* backward compatible.
|
|
877
|
-
*/
|
|
878
|
-
hideKeyboardAccessoryView?: boolean;
|
|
879
|
-
/**
|
|
880
|
-
* A Boolean value indicating whether horizontal swipe gestures will trigger
|
|
881
|
-
* back-forward list navigations.
|
|
882
|
-
*/
|
|
883
|
-
allowsBackForwardNavigationGestures?: boolean;
|
|
884
|
-
/**
|
|
885
|
-
* A Boolean value indicating whether WebKit WebView should be created using a shared
|
|
886
|
-
* process pool, enabling WebViews to share cookies and localStorage between each other.
|
|
887
|
-
* Default is true but can be set to false for backwards compatibility.
|
|
888
|
-
* @platform macos
|
|
889
|
-
*/
|
|
890
|
-
useSharedProcessPool?: boolean;
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* The custom user agent string.
|
|
894
|
-
*/
|
|
895
|
-
userAgent?: string;
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
* A Boolean value that determines whether pressing on a link
|
|
899
|
-
* displays a preview of the destination for the link.
|
|
900
|
-
*
|
|
901
|
-
* This property is available on devices that support Force Touch trackpad.
|
|
902
|
-
* @platform macos
|
|
903
|
-
*/
|
|
904
|
-
allowsLinkPreview?: boolean;
|
|
905
|
-
|
|
906
|
-
/**
|
|
907
|
-
* Set true if shared cookies from HTTPCookieStorage should used for every load request.
|
|
908
|
-
* The default value is `false`.
|
|
909
|
-
* @platform macos
|
|
910
|
-
*/
|
|
911
|
-
sharedCookiesEnabled?: boolean;
|
|
912
|
-
|
|
913
|
-
/**
|
|
914
|
-
* A Boolean value that determines whether scrolling is disabled in a particular direction.
|
|
915
|
-
* The default value is `true`.
|
|
916
|
-
* @platform macos
|
|
917
|
-
*/
|
|
918
|
-
directionalLockEnabled?: boolean;
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* A Boolean value indicating whether web content can programmatically display the keyboard.
|
|
922
|
-
*
|
|
923
|
-
* When this property is set to true, the user must explicitly tap the elements in the
|
|
924
|
-
* web view to display the keyboard (or other relevant input view) for that element.
|
|
925
|
-
* When set to false, a focus event on an element causes the input view to be displayed
|
|
926
|
-
* and associated with that element automatically.
|
|
927
|
-
*
|
|
928
|
-
* The default value is `true`.
|
|
929
|
-
* @platform macos
|
|
930
|
-
*/
|
|
931
|
-
keyboardDisplayRequiresUserAction?: boolean;
|
|
932
|
-
|
|
933
|
-
/**
|
|
934
|
-
* A String value that indicates which URLs the WebView's file can then
|
|
935
|
-
* reference in scripts, AJAX requests, and CSS imports. This is only used
|
|
936
|
-
* for WebViews that are loaded with a source.uri set to a `'file://'` URL.
|
|
937
|
-
*
|
|
938
|
-
* If not provided, the default is to only allow read access to the URL
|
|
939
|
-
* provided in source.uri itself.
|
|
940
|
-
* @platform macos
|
|
941
|
-
*/
|
|
942
|
-
allowingReadAccessToURL?: string;
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* Boolean that sets whether JavaScript running in the context of a file
|
|
946
|
-
* scheme URL should be allowed to access content from other file scheme URLs.
|
|
947
|
-
* Including accessing content from other file scheme URLs
|
|
948
|
-
* @platform macos
|
|
949
|
-
*/
|
|
950
|
-
allowFileAccessFromFileURLs?: boolean;
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* Boolean that sets whether JavaScript running in the context of a file
|
|
954
|
-
* scheme URL should be allowed to access content from any origin.
|
|
955
|
-
* Including accessing content from other file scheme URLs
|
|
956
|
-
* @platform macos
|
|
957
|
-
*/
|
|
958
|
-
allowUniversalAccessFromFileURLs?: boolean;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* Function that is invoked when the WebKit WebView content process gets terminated.
|
|
962
|
-
* @platform macos
|
|
963
|
-
*/
|
|
964
|
-
onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
630
|
export interface AndroidWebViewProps extends WebViewSharedProps {
|
|
968
631
|
onNavigationStateChange?: (event: WebViewNavigation) => void;
|
|
969
632
|
onContentSizeChange?: (event: WebViewEvent) => void;
|
|
@@ -1022,28 +685,6 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
|
|
|
1022
685
|
*/
|
|
1023
686
|
geolocationEnabled?: boolean;
|
|
1024
687
|
|
|
1025
|
-
/**
|
|
1026
|
-
* Boolean that sets whether JavaScript running in the context of a file
|
|
1027
|
-
* scheme URL should be allowed to access content from other file scheme URLs.
|
|
1028
|
-
* Including accessing content from other file scheme URLs
|
|
1029
|
-
* @platform android
|
|
1030
|
-
*/
|
|
1031
|
-
allowFileAccessFromFileURLs?: boolean;
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
* Boolean that sets whether JavaScript running in the context of a file
|
|
1035
|
-
* scheme URL should be allowed to access content from any origin.
|
|
1036
|
-
* Including accessing content from other file scheme URLs
|
|
1037
|
-
* @platform android
|
|
1038
|
-
*/
|
|
1039
|
-
allowUniversalAccessFromFileURLs?: boolean;
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
* Sets whether the webview allow access to file system.
|
|
1043
|
-
* @platform android
|
|
1044
|
-
*/
|
|
1045
|
-
allowFileAccess?: boolean;
|
|
1046
|
-
|
|
1047
688
|
/**
|
|
1048
689
|
* Used on Android only, controls whether form autocomplete data should be saved
|
|
1049
690
|
* @platform android
|
|
@@ -1217,12 +858,6 @@ export interface WebViewSharedProps extends ViewProps {
|
|
|
1217
858
|
*/
|
|
1218
859
|
javaScriptEnabled?: boolean;
|
|
1219
860
|
|
|
1220
|
-
/**
|
|
1221
|
-
* A Boolean value indicating whether JavaScript can open windows without user interaction.
|
|
1222
|
-
* The default value is `false`.
|
|
1223
|
-
*/
|
|
1224
|
-
javaScriptCanOpenWindowsAutomatically?: boolean;
|
|
1225
|
-
|
|
1226
861
|
/**
|
|
1227
862
|
* Stylesheet object to set the style of the container view.
|
|
1228
863
|
*/
|
|
@@ -1267,12 +902,6 @@ export interface WebViewSharedProps extends ViewProps {
|
|
|
1267
902
|
*/
|
|
1268
903
|
onError?: (event: WebViewErrorEvent) => void;
|
|
1269
904
|
|
|
1270
|
-
/**
|
|
1271
|
-
* Function that is invoked when the `WebView` receives an error status code.
|
|
1272
|
-
* Works on iOS and Android (minimum API level 23).
|
|
1273
|
-
*/
|
|
1274
|
-
onHttpError?: (event: WebViewHttpErrorEvent) => void;
|
|
1275
|
-
|
|
1276
905
|
/**
|
|
1277
906
|
* Function that is invoked when the `WebView` loading starts or ends.
|
|
1278
907
|
*/
|
|
@@ -1312,18 +941,6 @@ export interface WebViewSharedProps extends ViewProps {
|
|
|
1312
941
|
*/
|
|
1313
942
|
injectedJavaScriptBeforeContentLoaded?: string;
|
|
1314
943
|
|
|
1315
|
-
/**
|
|
1316
|
-
* If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
|
|
1317
|
-
* If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
|
|
1318
|
-
*/
|
|
1319
|
-
injectedJavaScriptForMainFrameOnly?: boolean;
|
|
1320
|
-
|
|
1321
|
-
/**
|
|
1322
|
-
* If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
|
|
1323
|
-
* If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
|
|
1324
|
-
*/
|
|
1325
|
-
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
|
|
1326
|
-
|
|
1327
944
|
/**
|
|
1328
945
|
* Boolean value that determines whether a horizontal scroll indicator is
|
|
1329
946
|
* shown in the `WebView`. The default value is `true`.
|
|
@@ -1366,22 +983,11 @@ export interface WebViewSharedProps extends ViewProps {
|
|
|
1366
983
|
*/
|
|
1367
984
|
onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest;
|
|
1368
985
|
|
|
1369
|
-
/**
|
|
1370
|
-
* Override the native component used to render the WebView. Enables a custom native
|
|
1371
|
-
* WebView which uses the same JavaScript as the original WebView.
|
|
1372
|
-
*/
|
|
1373
|
-
nativeConfig?: WebViewNativeConfig;
|
|
1374
|
-
|
|
1375
986
|
/**
|
|
1376
987
|
* Should caching be enabled. Default is true.
|
|
1377
988
|
*/
|
|
1378
989
|
cacheEnabled?: boolean;
|
|
1379
990
|
|
|
1380
|
-
/**
|
|
1381
|
-
* Append to the existing user-agent. Overridden if `userAgent` is set.
|
|
1382
|
-
*/
|
|
1383
|
-
applicationNameForUserAgent?: string;
|
|
1384
|
-
|
|
1385
991
|
/**
|
|
1386
992
|
* An object that specifies the credentials of a user to be used for basic authentication.
|
|
1387
993
|
*/
|
|
@@ -1,25 +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 an HTTP error is received.
|
|
9
|
-
*/
|
|
10
|
-
class TopHttpErrorEvent(viewId: Int, private val mEventData: WritableMap) :
|
|
11
|
-
Event<TopHttpErrorEvent>(viewId) {
|
|
12
|
-
companion object {
|
|
13
|
-
const val EVENT_NAME = "topHttpError"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
override fun getEventName(): String = EVENT_NAME
|
|
17
|
-
|
|
18
|
-
override fun canCoalesce(): Boolean = false
|
|
19
|
-
|
|
20
|
-
override fun getCoalescingKey(): Short = 0
|
|
21
|
-
|
|
22
|
-
override fun dispatch(rctEventEmitter: RCTEventEmitter) =
|
|
23
|
-
rctEventEmitter.receiveEvent(viewTag, eventName, mEventData)
|
|
24
|
-
|
|
25
|
-
}
|
package/lib/WebView.macos.d.ts
DELETED
package/lib/WebView.macos.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _invariant=_interopRequireDefault(require("invariant"));var _RNCWebViewNativeComponent=_interopRequireWildcard(require("./RNCWebViewNativeComponent"));var _NativeRNCWebViewModule=_interopRequireDefault(require("./NativeRNCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["javaScriptEnabled","cacheEnabled","originWhitelist","deeplinkWhitelist","useSharedProcessPool","injectedJavaScript","injectedJavaScriptBeforeContentLoaded","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onMessage","renderLoading","renderError","style","containerStyle","source","nativeConfig","allowsInlineMediaPlayback","allowsPictureInPictureMediaPlayback","allowsAirPlayForMediaPlayback","mediaPlaybackRequiresUserAction","incognito","onShouldStartLoadWithRequest","validateMeta","validateData"];var _this=this,_jsxFileName="/Users/raulgomezacuna/Development/react-native-webview/src/WebView.macos.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var useWarnIfChanges=function useWarnIfChanges(value,name){var ref=(0,_react.useRef)(value);if(ref.current!==value){console.warn(`Changes to property ${name} do nothing after the initial render.`);ref.current=value;}};var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$deeplinkWhitelis=_ref.deeplinkWhitelist,deeplinkWhitelist=_ref$deeplinkWhitelis===void 0?_WebViewShared.defaultDeeplinkWhitelist:_ref$deeplinkWhitelis,_ref$useSharedProcess=_ref.useSharedProcessPool,useSharedProcessPool=_ref$useSharedProcess===void 0?true:_ref$useSharedProcess,injectedJavaScript=_ref.injectedJavaScript,injectedJavaScriptBeforeContentLoaded=_ref.injectedJavaScriptBeforeContentLoaded,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onMessageProp=_ref.onMessage,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,allowsInlineMediaPlayback=_ref.allowsInlineMediaPlayback,_ref$allowsPictureInP=_ref.allowsPictureInPictureMediaPlayback,allowsPictureInPictureMediaPlayback=_ref$allowsPictureInP===void 0?true:_ref$allowsPictureInP,allowsAirPlayForMediaPlayback=_ref.allowsAirPlayForMediaPlayback,mediaPlaybackRequiresUserAction=_ref.mediaPlaybackRequiresUserAction,incognito=_ref.incognito,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,validateMeta=_ref.validateMeta,validateData=_ref.validateData,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,_url){var lockIdentifier=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_NativeRNCWebViewModule.default.shouldStartLoadWithLockIdentifier(!!shouldStart,lockIdentifier);},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onMessageProp:onMessageProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,deeplinkWhitelist:deeplinkWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback,validateMeta:validateMeta,validateData:validateData}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onContentProcessDidTerminate=_useWebViewLogic.onContentProcessDidTerminate;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_RNCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_RNCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);}};},[setViewState,webViewRef]);useWarnIfChanges(allowsInlineMediaPlayback,'allowsInlineMediaPlayback');useWarnIfChanges(allowsPictureInPictureMediaPlayback,'allowsPictureInPictureMediaPlayback');useWarnIfChanges(allowsAirPlayForMediaPlayback,'allowsAirPlayForMediaPlayback');useWarnIfChanges(incognito,'incognito');useWarnIfChanges(mediaPlaybackRequiresUserAction,'mediaPlaybackRequiresUserAction');var otherView=null;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){var _lastErrorEvent$descr;(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent==null?void 0:lastErrorEvent.domain,(lastErrorEvent==null?void 0:lastErrorEvent.code)||0,(_lastErrorEvent$descr=lastErrorEvent==null?void 0:lastErrorEvent.description)!=null?_lastErrorEvent$descr:'');}else if(viewState!=='IDLE'){console.error(`RNCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_RNCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{javaScriptEnabled:javaScriptEnabled,cacheEnabled:cacheEnabled,useSharedProcessPool:useSharedProcessPool,messagingEnabled:typeof onMessageProp==='function',newSource:newSource,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onMessage:onMessage,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onContentProcessDidTerminate:onContentProcessDidTerminate,injectedJavaScript:injectedJavaScript,injectedJavaScriptBeforeContentLoaded:injectedJavaScriptBeforeContentLoaded,allowsAirPlayForMediaPlayback:allowsAirPlayForMediaPlayback,allowsInlineMediaPlayback:allowsInlineMediaPlayback,allowsPictureInPictureMediaPlayback:allowsPictureInPictureMediaPlayback,incognito:incognito,mediaPlaybackRequiresUserAction:mediaPlaybackRequiresUserAction,ref:webViewRef,source:sourceResolved,style:webViewStyles},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(){return true;});return function isFileUploadSupported(){return _ref6.apply(this,arguments);};}();var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
package/lib/WebView.windows.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* Portions copyright for react-native-windows:
|
|
8
|
-
*
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License.
|
|
11
|
-
*/
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { WindowsWebViewProps } from './WebViewTypes';
|
|
14
|
-
declare const WebView: React.ForwardRefExoticComponent<WindowsWebViewProps & React.RefAttributes<{}>> & {
|
|
15
|
-
isFileUploadSupported: () => Promise<boolean>;
|
|
16
|
-
};
|
|
17
|
-
export default WebView;
|
package/lib/WebView.windows.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var _invariant=_interopRequireDefault(require("invariant"));var _WebViewNativeComponent=require("./WebViewNativeComponent.windows");var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["cacheEnabled","originWhitelist","deeplinkWhitelist","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onOpenWindow","onSourceChanged","onHttpError","onMessage","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","useWebView2","validateMeta","validateData"];var _this=this,_jsxFileName="/Users/raulgomezacuna/Development/react-native-webview/src/WebView.windows.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Commands=(0,_codegenNativeCommands.default)({supportedCommands:['goBack','goForward','reload','stopLoading','injectJavaScript','requestFocus','clearCache','postMessage','loadUrl']});var resolveAssetSource=_reactNative.Image.resolveAssetSource;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$deeplinkWhitelis=_ref.deeplinkWhitelist,deeplinkWhitelist=_ref$deeplinkWhitelis===void 0?_WebViewShared.defaultDeeplinkWhitelist:_ref$deeplinkWhitelis,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onOpenWindowProp=_ref.onOpenWindow,onSourceChanged=_ref.onSourceChanged,onHttpErrorProp=_ref.onHttpError,onMessageProp=_ref.onMessage,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,useWebView2=_ref.useWebView2,validateMeta=_ref.validateMeta,validateData=_ref.validateData,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var webViewRef=(0,_react.useRef)(null);var RCTWebViewString=useWebView2?'RCTWebView2':'RCTWebView';var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){if(RCTWebViewString==='RCTWebView'){_reactNative.NativeModules.RCTWebView.onShouldStartLoadWithRequestCallback(shouldStart,lockIdentifier);}else{_reactNative.NativeModules.RCTWebView2.onShouldStartLoadWithRequestCallback(shouldStart,lockIdentifier);}}else if(shouldStart){Commands.loadUrl(webViewRef,url);}},[RCTWebViewString]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onMessageProp:onMessageProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,deeplinkWhitelist:deeplinkWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback,onOpenWindowProp:onOpenWindowProp,validateMeta:validateMeta,validateData:validateData}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return Commands.goForward(webViewRef.current);},goBack:function goBack(){return Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');Commands.reload(webViewRef.current);},stopLoading:function stopLoading(){return Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return Commands.requestFocus(webViewRef.current);},clearCache:function clearCache(){return Commands.clearCache(webViewRef.current);},loadUrl:function loadUrl(url){return Commands.loadUrl(webViewRef.current,url);}};},[setViewState,webViewRef]);var otherView=null;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}else if(viewState!=='IDLE'){console.error(`RNCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];var NativeWebView=useWebView2?_WebViewNativeComponent.RCTWebView2:_WebViewNativeComponent.RCTWebView;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',linkHandlingEnabled:typeof onOpenWindowProp==='function',onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onMessage:onMessage,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onOpenWindow:onOpenWindow,onSourceChanged:onSourceChanged,ref:webViewRef,source:resolveAssetSource(source),style:webViewStyles,cacheEnabled:cacheEnabled},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(){return false;});return function isFileUploadSupported(){return _ref2.apply(this,arguments);};}();var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.RCTWebView2=exports.RCTWebView=void 0;var _reactNative=require("react-native");var RCTWebView=exports.RCTWebView=(0,_reactNative.requireNativeComponent)('RCTWebView');var RCTWebView2=exports.RCTWebView2=(0,_reactNative.requireNativeComponent)('RCTWebView2');
|