@exodus/react-native-webview 11.26.1-exodus.12 → 11.26.1-exodus.14
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/RNCWebViewManager.java +5 -6
- package/apple/RNCWebView.h +1 -0
- package/apple/RNCWebView.m +17 -10
- package/apple/RNCWebViewManager.m +1 -0
- package/lib/WebView.android.js +2 -3
- package/lib/WebView.ios.js +2 -3
- package/lib/WebViewTypes.d.ts +5 -0
- package/package.json +1 -1
|
@@ -338,6 +338,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|
|
338
338
|
CookieManager.getInstance().setAcceptThirdPartyCookies(view, enabled);
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
@ReactProp(name = "webviewDebuggingEnabled")
|
|
342
|
+
public void setWebviewDebuggingEnabled(WebView view, boolean value) {
|
|
343
|
+
((RNCWebView) view).setWebContentsDebuggingEnabled(value);
|
|
344
|
+
}
|
|
345
|
+
|
|
341
346
|
@ReactProp(name = "textZoom")
|
|
342
347
|
public void setTextZoom(WebView view, int value) {
|
|
343
348
|
view.getSettings().setTextZoom(value);
|
|
@@ -430,12 +435,6 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
|
|
430
435
|
@ReactProp(name = "source")
|
|
431
436
|
public void setSource(WebView view, @Nullable ReadableMap source) {
|
|
432
437
|
if (source != null) {
|
|
433
|
-
if (source.hasKey("html")) {
|
|
434
|
-
String html = source.getString("html");
|
|
435
|
-
String baseUrl = source.hasKey("baseUrl") ? source.getString("baseUrl") : "";
|
|
436
|
-
view.loadDataWithBaseURL(baseUrl, html, HTML_MIME_TYPE, HTML_ENCODING, null);
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
438
|
if (source.hasKey("uri")) {
|
|
440
439
|
String url = source.getString("uri");
|
|
441
440
|
String previousUrl = view.getUrl();
|
package/apple/RNCWebView.h
CHANGED
|
@@ -48,6 +48,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *_Nonnull)request
|
|
|
48
48
|
@property (nonatomic, assign) BOOL pagingEnabled;
|
|
49
49
|
@property (nonatomic, assign) CGFloat decelerationRate;
|
|
50
50
|
@property (nonatomic, assign) BOOL allowsInlineMediaPlayback;
|
|
51
|
+
@property (nonatomic, assign) BOOL webviewDebuggingEnabled;
|
|
51
52
|
@property (nonatomic, assign) BOOL bounces;
|
|
52
53
|
@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction;
|
|
53
54
|
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
package/apple/RNCWebView.m
CHANGED
|
@@ -406,6 +406,13 @@ RCTAutoInsetsProtocol>
|
|
|
406
406
|
}
|
|
407
407
|
#endif
|
|
408
408
|
|
|
409
|
+
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || \
|
|
410
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \
|
|
411
|
+
__TV_OS_VERSION_MAX_ALLOWED >= 160400
|
|
412
|
+
if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
|
|
413
|
+
_webView.inspectable = _webviewDebuggingEnabled;
|
|
414
|
+
#endif
|
|
415
|
+
|
|
409
416
|
[self addSubview:_webView];
|
|
410
417
|
[self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView];
|
|
411
418
|
[self setKeyboardDisplayRequiresUserAction: _savedKeyboardDisplayRequiresUserAction];
|
|
@@ -431,6 +438,16 @@ RCTAutoInsetsProtocol>
|
|
|
431
438
|
_webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
|
|
432
439
|
}
|
|
433
440
|
|
|
441
|
+
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || \
|
|
442
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \
|
|
443
|
+
__TV_OS_VERSION_MAX_ALLOWED >= 160400
|
|
444
|
+
- (void)setWebviewDebuggingEnabled:(BOOL)webviewDebuggingEnabled {
|
|
445
|
+
_webviewDebuggingEnabled = webviewDebuggingEnabled;
|
|
446
|
+
if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
|
|
447
|
+
_webView.inspectable = _webviewDebuggingEnabled;
|
|
448
|
+
}
|
|
449
|
+
#endif
|
|
450
|
+
|
|
434
451
|
- (void)removeFromSuperview
|
|
435
452
|
{
|
|
436
453
|
if (_webView) {
|
|
@@ -615,16 +632,6 @@ RCTAutoInsetsProtocol>
|
|
|
615
632
|
|
|
616
633
|
- (void)visitSource
|
|
617
634
|
{
|
|
618
|
-
// Check for a static html source first
|
|
619
|
-
NSString *html = [RCTConvert NSString:_source[@"html"]];
|
|
620
|
-
if (html) {
|
|
621
|
-
NSURL *baseURL = [RCTConvert NSURL:_source[@"baseUrl"]];
|
|
622
|
-
if (!baseURL) {
|
|
623
|
-
baseURL = [NSURL URLWithString:@"about:blank"];
|
|
624
|
-
}
|
|
625
|
-
[_webView loadHTMLString:html baseURL:baseURL];
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
635
|
// Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView
|
|
629
636
|
NSString *headerCookie = [RCTConvert NSString:_source[@"headers"][@"cookie"]];
|
|
630
637
|
if(headerCookie) {
|
|
@@ -63,6 +63,7 @@ RCT_EXPORT_VIEW_PROPERTY(injectedJavaScript, NSString)
|
|
|
63
63
|
RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoaded, NSString)
|
|
64
64
|
RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
|
|
65
65
|
RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
|
|
66
|
+
RCT_EXPORT_VIEW_PROPERTY(webviewDebuggingEnabled, BOOL)
|
|
66
67
|
RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)
|
|
67
68
|
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
|
68
69
|
RCT_EXPORT_VIEW_PROPERTY(dataDetectorTypes, WKDataDetectorTypes)
|
package/lib/WebView.android.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { Text,
|
|
2
|
+
import { Text, View, NativeModules, } from 'react-native';
|
|
3
3
|
import BatchedBridge from 'react-native/Libraries/BatchedBridge/BatchedBridge';
|
|
4
4
|
// @ts-expect-error react-native doesn't have this type
|
|
5
5
|
import codegenNativeCommandsUntyped from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
@@ -19,7 +19,6 @@ const codegenNativeCommands = codegenNativeCommandsUntyped;
|
|
|
19
19
|
const Commands = codegenNativeCommands({
|
|
20
20
|
supportedCommands: ['goBack', 'goForward', 'reload', 'stopLoading', /* 'injectJavaScript', */ 'requestFocus', 'postMessage', 'clearFormData', 'clearCache', 'clearHistory', 'loadUrl'],
|
|
21
21
|
});
|
|
22
|
-
const { resolveAssetSource } = Image;
|
|
23
22
|
/**
|
|
24
23
|
* A simple counter to uniquely identify WebView instances. Do not use this for anything else.
|
|
25
24
|
*/
|
|
@@ -124,7 +123,7 @@ const WebViewComponent = forwardRef(({ overScrollMode = 'always', javaScriptEnab
|
|
|
124
123
|
const NativeWebView = RNCWebView;
|
|
125
124
|
const webView = <NativeWebView key="webViewKey" {...otherProps} messagingEnabled={typeof onMessageProp === 'function'} messagingModuleName={messagingModuleName} onLoadingError={onLoadingError} onLoadingFinish={onLoadingFinish} onLoadingProgress={onLoadingProgress} onLoadingStart={onLoadingStart} onMessage={onMessage} onShouldStartLoadWithRequest={onShouldStartLoadWithRequest} ref={webViewRef}
|
|
126
125
|
// TODO: find a better way to type this.
|
|
127
|
-
source={
|
|
126
|
+
source={source} style={webViewStyles} overScrollMode={overScrollMode} javaScriptEnabled={javaScriptEnabled} thirdPartyCookiesEnabled={thirdPartyCookiesEnabled} scalesPageToFit={scalesPageToFit} saveFormDataDisabled={saveFormDataDisabled} cacheEnabled={cacheEnabled} androidHardwareAccelerationDisabled={androidHardwareAccelerationDisabled} androidLayerType={androidLayerType} setSupportMultipleWindows={setSupportMultipleWindows} setBuiltInZoomControls={setBuiltInZoomControls} setDisplayZoomControls={setDisplayZoomControls} mixedContentMode={mixedContentMode} nestedScrollEnabled={nestedScrollEnabled} mediaPlaybackRequiresUserAction={mediaPlaybackRequiresUserAction}/>;
|
|
128
127
|
return (<View style={webViewContainerStyle}>
|
|
129
128
|
{webView}
|
|
130
129
|
{otherView}
|
package/lib/WebView.ios.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { Text,
|
|
2
|
+
import { Text, View, NativeModules, Platform, } from 'react-native';
|
|
3
3
|
import invariant from 'invariant';
|
|
4
4
|
// @ts-expect-error react-native doesn't have this type
|
|
5
5
|
import codegenNativeCommandsUntyped from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
@@ -10,7 +10,6 @@ const codegenNativeCommands = codegenNativeCommandsUntyped;
|
|
|
10
10
|
const Commands = codegenNativeCommands({
|
|
11
11
|
supportedCommands: ['goBack', 'goForward', 'reload', 'stopLoading', /* 'injectJavaScript', */ 'requestFocus', 'postMessage', 'loadUrl'],
|
|
12
12
|
});
|
|
13
|
-
const { resolveAssetSource } = Image;
|
|
14
13
|
const processDecelerationRate = (decelerationRate) => {
|
|
15
14
|
let newDecelerationRate = decelerationRate;
|
|
16
15
|
if (newDecelerationRate === 'normal') {
|
|
@@ -103,7 +102,7 @@ const WebViewComponent = forwardRef(({ javaScriptEnabled = true, cacheEnabled =
|
|
|
103
102
|
const NativeWebView = RNCWebView;
|
|
104
103
|
const webView = (<NativeWebView key="webViewKey" {...otherProps} enableApplePay={enableApplePay} javaScriptEnabled={javaScriptEnabled} cacheEnabled={cacheEnabled} dataDetectorTypes={dataDetectorTypes} useSharedProcessPool={useSharedProcessPool} textInteractionEnabled={textInteractionEnabled} decelerationRate={decelerationRate} messagingEnabled={typeof onMessageProp === 'function'} onLoadingError={onLoadingError} onLoadingFinish={onLoadingFinish} onLoadingProgress={onLoadingProgress} onLoadingStart={onLoadingStart} onMessage={onMessage} onShouldStartLoadWithRequest={onShouldStartLoadWithRequest} injectedJavaScript={injectedJavaScript} injectedJavaScriptBeforeContentLoaded={injectedJavaScriptBeforeContentLoaded} allowsInlineMediaPlayback={allowsInlineMediaPlayback} incognito={incognito} mediaPlaybackRequiresUserAction={mediaPlaybackRequiresUserAction} ref={webViewRef} sharedCookiesEnabled={sharedCookiesEnabled}
|
|
105
104
|
// TODO: find a better way to type this.
|
|
106
|
-
source={
|
|
105
|
+
source={source} style={webViewStyles}/>);
|
|
107
106
|
return (<View style={webViewContainerStyle}>
|
|
108
107
|
{webView}
|
|
109
108
|
{otherView}
|
package/lib/WebViewTypes.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ export interface CommonNativeWebViewProps extends ViewProps {
|
|
|
146
146
|
injectedJavaScript?: string;
|
|
147
147
|
injectedJavaScriptBeforeContentLoaded?: string;
|
|
148
148
|
mediaPlaybackRequiresUserAction?: boolean;
|
|
149
|
+
webviewDebuggingEnabled?: boolean;
|
|
149
150
|
messagingEnabled: boolean;
|
|
150
151
|
onScroll?: (event: WebViewScrollEvent) => void;
|
|
151
152
|
onLoadingError: (event: WebViewErrorEvent) => void;
|
|
@@ -713,6 +714,10 @@ export interface WebViewSharedProps extends ViewProps {
|
|
|
713
714
|
* An object that specifies the credentials of a user to be used for basic authentication.
|
|
714
715
|
*/
|
|
715
716
|
basicAuthCredential?: BasicAuthCredential;
|
|
717
|
+
/**
|
|
718
|
+
* Enables WebView remote debugging using Chrome (Android) or Safari (iOS).
|
|
719
|
+
*/
|
|
720
|
+
webviewDebuggingEnabled?: boolean;
|
|
716
721
|
/**
|
|
717
722
|
* Event metadata validation.
|
|
718
723
|
*/
|
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.
|
|
12
|
+
"version": "11.26.1-exodus.14",
|
|
13
13
|
"homepage": "https://github.com/ExodusMovement/react-native-webview#readme",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"android": "react-native run-android",
|