From ad702f57f16eb0630af6e4fa34416d06b27a8552 Mon Sep 17 00:00:00 2001
From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com>
Date: Wed, 10 Feb 2021 03:59:13 -0800
Subject: [PATCH 01/19] fix(windows): Resolve Deploy Issue (#1850)
---
windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj b/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj
index a7e95096f..21003647d 100644
--- a/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj
+++ b/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj
@@ -148,6 +148,7 @@
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
From 83af1b6d93a725d2a909c5a11bfb33e57084030d Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Wed, 10 Feb 2021 12:01:53 +0000
Subject: [PATCH 02/19] chore(release): 11.2.2 [skip ci]
## [11.2.2](https://github.com/react-native-webview/react-native-webview/compare/v11.2.1...v11.2.2) (2021-02-10)
### Bug Fixes
* **windows:** Resolve Deploy Issue ([#1850](https://github.com/react-native-webview/react-native-webview/issues/1850)) ([ad702f5](https://github.com/react-native-webview/react-native-webview/commit/ad702f57f16eb0630af6e4fa34416d06b27a8552))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index b25e2da13..a9f85d497 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.2.1",
+ "version": "11.2.2",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 4f469ee9aab9f6db5f9905c6276dc604d231cd5d Mon Sep 17 00:00:00 2001
From: Cristiano Coelho <48869228+cristianoccazinsp@users.noreply.github.com>
Date: Thu, 11 Feb 2021 02:09:09 -0300
Subject: [PATCH 03/19] fix(android): Fix full=screen video when in modals
(#1748 by @cristianoccazinsp)
Co-authored-by: Cristiano Coelho
Co-authored-by: Thibault Malbranche
---
.../webview/RNCWebViewManager.java | 43 +++++++++++++++----
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
index 2190ae714..952e46ead 100644
--- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
+++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
@@ -734,8 +734,25 @@ public void onShowCustomView(View view, CustomViewCallback callback) {
}
mVideoView.setBackgroundColor(Color.BLACK);
- getRootView().addView(mVideoView, FULLSCREEN_LAYOUT_PARAMS);
- mWebView.setVisibility(View.GONE);
+
+ // since RN's Modals interfere with the View hierarchy
+ // we will decide which View to Hide if the hierarchy
+ // does not match (i.e., the webview is within a Modal)
+ // NOTE: We could use mWebView.getRootView() instead of getRootView()
+ // but that breaks the Modal's styles and layout, so we need this to render
+ // in the main View hierarchy regardless.
+ ViewGroup rootView = getRootView();
+ rootView.addView(mVideoView, FULLSCREEN_LAYOUT_PARAMS);
+
+ // Different root views, we are in a Modal
+ if(rootView.getRootView() != mWebView.getRootView()){
+ mWebView.getRootView().setVisibility(View.GONE);
+ }
+
+ // Same view hierarchy (no Modal), just hide the webview then
+ else{
+ mWebView.setVisibility(View.GONE);
+ }
mReactContext.addLifecycleEventListener(this);
}
@@ -746,18 +763,28 @@ public void onHideCustomView() {
return;
}
- mVideoView.setVisibility(View.GONE);
- getRootView().removeView(mVideoView);
- mCustomViewCallback.onCustomViewHidden();
+ // same logic as above
+ ViewGroup rootView = getRootView();
- mVideoView = null;
- mCustomViewCallback = null;
+ if(rootView.getRootView() != mWebView.getRootView()){
+ mWebView.getRootView().setVisibility(View.VISIBLE);
+ }
- mWebView.setVisibility(View.VISIBLE);
+ // Same view hierarchy (no Modal)
+ else{
+ mWebView.setVisibility(View.VISIBLE);
+ }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mReactContext.getCurrentActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
+
+ rootView.removeView(mVideoView);
+ mCustomViewCallback.onCustomViewHidden();
+
+ mVideoView = null;
+ mCustomViewCallback = null;
+
mReactContext.getCurrentActivity().setRequestedOrientation(initialRequestedOrientation);
mReactContext.removeLifecycleEventListener(this);
From dd315bcf87d7bdbbcf7e63f9afa17c8f59b368bc Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Thu, 11 Feb 2021 05:11:02 +0000
Subject: [PATCH 04/19] chore(release): 11.2.3 [skip ci]
## [11.2.3](https://github.com/react-native-webview/react-native-webview/compare/v11.2.2...v11.2.3) (2021-02-11)
### Bug Fixes
* **android:** Fix full=screen video when in modals ([#1748](https://github.com/react-native-webview/react-native-webview/issues/1748) by [@cristianoccazinsp](https://github.com/cristianoccazinsp)) ([4f469ee](https://github.com/react-native-webview/react-native-webview/commit/4f469ee9aab9f6db5f9905c6276dc604d231cd5d))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index a9f85d497..4bbbf3952 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.2.2",
+ "version": "11.2.3",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 1f089baa40a04f9e71ee598c6248da7fc47aef6d Mon Sep 17 00:00:00 2001
From: nikitawani07
Date: Wed, 10 Mar 2021 14:41:09 +0530
Subject: [PATCH 05/19] fix(iOS): Send cookies with resource requests (#1803)
* iOS cookie available for resource requests
* Missig brace added
Co-authored-by: niwani
---
apple/RNCWebView.m | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/apple/RNCWebView.m b/apple/RNCWebView.m
index 91a96e68b..2dca83767 100644
--- a/apple/RNCWebView.m
+++ b/apple/RNCWebView.m
@@ -543,6 +543,16 @@ - (void)visitSource
}
[_webView loadHTMLString:html baseURL:baseURL];
return;
+ }
+ //Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView
+ NSString *headerCookie = [RCTConvert NSString:_source[@"headers"][@"cookie"]];
+ if(headerCookie) {
+ NSDictionary *headers = [NSDictionary dictionaryWithObjectsAndKeys:headerCookie,@"Set-Cookie",nil];
+ NSURL *urlString = [NSURL URLWithString:_source[@"uri"]];
+ NSArray *httpCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:urlString];
+ for (NSHTTPCookie *httpCookie in httpCookies) {
+ [_webView.configuration.websiteDataStore.httpCookieStore setCookie:httpCookie completionHandler:nil];
+ }
}
NSURLRequest *request = [self requestForSource:_source];
From 099087f8d95fbc600d2a38a11ccb87481e687521 Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Wed, 10 Mar 2021 09:14:30 +0000
Subject: [PATCH 06/19] chore(release): 11.2.4 [skip ci]
## [11.2.4](https://github.com/react-native-webview/react-native-webview/compare/v11.2.3...v11.2.4) (2021-03-10)
### Bug Fixes
* **iOS:** Send cookies with resource requests ([#1803](https://github.com/react-native-webview/react-native-webview/issues/1803)) ([1f089ba](https://github.com/react-native-webview/react-native-webview/commit/1f089baa40a04f9e71ee598c6248da7fc47aef6d))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 4bbbf3952..5cdeeda3f 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.2.3",
+ "version": "11.2.4",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 30a53d9480c5ca1a120063622a4c19684fcf6817 Mon Sep 17 00:00:00 2001
From: sunzhongliang <543167061@qq.com>
Date: Mon, 15 Mar 2021 17:19:45 +0800
Subject: [PATCH 07/19] fix(iOS): webview retain cycle (#1916)
Co-authored-by: sunzhongliang
---
apple/RNCWebView.m | 1 +
1 file changed, 1 insertion(+)
diff --git a/apple/RNCWebView.m b/apple/RNCWebView.m
index 2dca83767..f84005952 100644
--- a/apple/RNCWebView.m
+++ b/apple/RNCWebView.m
@@ -331,6 +331,7 @@ - (void)setAllowsBackForwardNavigationGestures:(BOOL)allowsBackForwardNavigation
- (void)removeFromSuperview
{
if (_webView) {
+ [_webView.configuration.userContentController removeScriptMessageHandlerForName:HistoryShimName];
[_webView.configuration.userContentController removeScriptMessageHandlerForName:MessageHandlerName];
[_webView removeObserver:self forKeyPath:@"estimatedProgress"];
[_webView removeFromSuperview];
From f7504ccead8bd93e679849c2f8f69e7b6710aa31 Mon Sep 17 00:00:00 2001
From: Bhargab
Date: Mon, 15 Mar 2021 15:05:57 +0545
Subject: [PATCH 08/19] chore(docs): fixed "postMessage" url in Reference.md
(#1913)
---
docs/Reference.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/Reference.md b/docs/Reference.md
index 037293e75..49980e313 100644
--- a/docs/Reference.md
+++ b/docs/Reference.md
@@ -88,7 +88,7 @@ This document lays out the current public properties and methods for the React N
- [`clearCache`](Reference.md#clearCache)
- [`clearHistory`](Reference.md#clearHistory)
- [`requestFocus`](Reference.md#requestFocus)
-- [`postMessage`](Reference.md#postMessage)
+- [`postMessage`](Reference.md#postmessagestr)
---
From 9c51a170405495fb32b2e7269675fefd1c657196 Mon Sep 17 00:00:00 2001
From: Erik Rothoff Andersson
Date: Mon, 15 Mar 2021 10:21:35 +0100
Subject: [PATCH 09/19] chore(docs): Clarify that navigationType and isTopFrame
is iOS only (#1880)
---
docs/Reference.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/Reference.md b/docs/Reference.md
index 49980e313..7896a021d 100644
--- a/docs/Reference.md
+++ b/docs/Reference.md
@@ -550,7 +550,7 @@ The `navState` object includes these properties:
canGoBack
canGoForward
loading
-navigationType
+navigationType (iOS only)
target
title
url
@@ -729,8 +729,8 @@ canGoBack
canGoForward
lockIdentifier
mainDocumentURL (iOS only)
-navigationType
-isTopFrame
+navigationType (iOS only)
+isTopFrame (iOS only)
```
---
From 4c71ff2d93374f1489055a22f5331a418dfb6c71 Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Mon, 15 Mar 2021 09:23:13 +0000
Subject: [PATCH 10/19] chore(release): 11.2.5 [skip ci]
## [11.2.5](https://github.com/react-native-webview/react-native-webview/compare/v11.2.4...v11.2.5) (2021-03-15)
### Bug Fixes
* **iOS:** webview retain cycle ([#1916](https://github.com/react-native-webview/react-native-webview/issues/1916)) ([30a53d9](https://github.com/react-native-webview/react-native-webview/commit/30a53d9480c5ca1a120063622a4c19684fcf6817))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 5cdeeda3f..1af327a9b 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.2.4",
+ "version": "11.2.5",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 85dfca894f3fdcd03e527324ac33611090ebb291 Mon Sep 17 00:00:00 2001
From: Andrew Goodale
Date: Tue, 16 Mar 2021 19:23:46 -0400
Subject: [PATCH 11/19] fix(ios): Add missing nullability specifiers; fix if
block warning (#1898)
---
apple/RNCWebView.h | 11 +++++++----
apple/RNCWebView.m | 3 ++-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/apple/RNCWebView.h b/apple/RNCWebView.h
index 5a28a113c..7eea05184 100644
--- a/apple/RNCWebView.h
+++ b/apple/RNCWebView.h
@@ -20,8 +20,11 @@
@end
@interface RNCWeakScriptMessageDelegate : NSObject
-@property (nonatomic, weak) id scriptDelegate;
-- (instancetype)initWithDelegate:(id)scriptDelegate;
+
+@property (nonatomic, weak, nullable) id scriptDelegate;
+
+- (nullable instancetype)initWithDelegate:(id _Nullable)scriptDelegate;
+
@end
@interface RNCWebView : RCTView
@@ -66,7 +69,7 @@
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
@property (nonatomic, assign) BOOL pullToRefreshEnabled;
#if !TARGET_OS_OSX
-@property (nonatomic, weak) UIRefreshControl * refreshControl;
+@property (nonatomic, weak) UIRefreshControl * _Nullable refreshControl;
#endif
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
@@ -83,7 +86,7 @@
- (void)stopLoading;
#if !TARGET_OS_OSX
- (void)addPullToRefreshControl;
-- (void)pullToRefresh:(UIRefreshControl *)refreshControl;
+- (void)pullToRefresh:(UIRefreshControl *_Nonnull)refreshControl;
#endif
@end
diff --git a/apple/RNCWebView.m b/apple/RNCWebView.m
index f84005952..0cd79a676 100644
--- a/apple/RNCWebView.m
+++ b/apple/RNCWebView.m
@@ -1064,7 +1064,8 @@ - (void) webView:(WKWebView *)webView
return;
}
- if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102 || [error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 101) {
+ if ([error.domain isEqualToString:@"WebKitErrorDomain"] &&
+ (error.code == 102 || error.code == 101)) {
// Error code 102 "Frame load interrupted" is raised by the WKWebView
// when the URL is from an http redirect. This is a common pattern when
// implementing OAuth with a WebView.
From 2aa8cee5eec2955a25376acb56f1db42481fd7eb Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Tue, 16 Mar 2021 23:25:21 +0000
Subject: [PATCH 12/19] chore(release): 11.2.6 [skip ci]
## [11.2.6](https://github.com/react-native-webview/react-native-webview/compare/v11.2.5...v11.2.6) (2021-03-16)
### Bug Fixes
* **ios:** Add missing nullability specifiers; fix if block warning ([#1898](https://github.com/react-native-webview/react-native-webview/issues/1898)) ([85dfca8](https://github.com/react-native-webview/react-native-webview/commit/85dfca894f3fdcd03e527324ac33611090ebb291))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 1af327a9b..7f7ab0493 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.2.5",
+ "version": "11.2.6",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 7decc5cff1de221ad729ab16f7b18901dc2f889a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivari=20T=C3=B6lp?=
Date: Wed, 17 Mar 2021 01:29:40 +0200
Subject: [PATCH 13/19] feat(ios): Add support for
`limitsNavigationsToAppBoundDomains` (#1662)
* Add support for iOS-specific prop `limitsNavigationsToAppBoundDomains`
* Add check for `limitsNavigationsToAppBoundDomains` property
Turns out that @available is simply bugged right
now in Xcode and will pretty much always return
`true`. Adding a check for the property actually
existing as well will avoid iOS <14 crashing horribly.
* Improve documentation
Co-authored-by: Thibault Malbranche
---
apple/RNCWebView.h | 4 ++++
apple/RNCWebView.m | 10 ++++++++++
apple/RNCWebViewManager.m | 4 ++++
docs/Reference.md | 20 ++++++++++++++++++++
src/WebViewTypes.ts | 12 ++++++++++++
5 files changed, 50 insertions(+)
diff --git a/apple/RNCWebView.h b/apple/RNCWebView.h
index 7eea05184..805031e9a 100644
--- a/apple/RNCWebView.h
+++ b/apple/RNCWebView.h
@@ -76,6 +76,10 @@
@property (nonatomic, assign) WKContentMode contentMode;
#endif
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */
+@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains;
+#endif
+
+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
+ (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
- (void)postMessage:(NSString *_Nullable)message;
diff --git a/apple/RNCWebView.m b/apple/RNCWebView.m
index 0cd79a676..9658d0318 100644
--- a/apple/RNCWebView.m
+++ b/apple/RNCWebView.m
@@ -245,6 +245,16 @@ - (WKWebViewConfiguration *)setUpWkWebViewConfig
}
#endif
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */
+ if (@available(iOS 14.0, *)) {
+ if ([wkWebViewConfig respondsToSelector:@selector(limitsNavigationsToAppBoundDomains)]) {
+ if (_limitsNavigationsToAppBoundDomains) {
+ wkWebViewConfig.limitsNavigationsToAppBoundDomains = YES;
+ }
+ }
+ }
+#endif
+
// Shim the HTML5 history API:
[wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
name:HistoryShimName];
diff --git a/apple/RNCWebViewManager.m b/apple/RNCWebViewManager.m
index fd522f113..270d3e47e 100644
--- a/apple/RNCWebViewManager.m
+++ b/apple/RNCWebViewManager.m
@@ -89,6 +89,10 @@ - (RCTUIView *)view
RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode)
#endif
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */
+RCT_EXPORT_VIEW_PROPERTY(limitsNavigationsToAppBoundDomains, BOOL)
+#endif
+
/**
* Expose methods to enable messaging the webview.
*/
diff --git a/docs/Reference.md b/docs/Reference.md
index 7896a021d..7fd4ebaa8 100644
--- a/docs/Reference.md
+++ b/docs/Reference.md
@@ -73,6 +73,7 @@ This document lays out the current public properties and methods for the React N
- [`pullToRefreshEnabled`](Reference.md#pullToRefreshEnabled)
- [`ignoreSilentHardwareSwitch`](Reference.md#ignoreSilentHardwareSwitch)
- [`onFileDownload`](Reference.md#onFileDownload)
+- [`limitsNavigationsToAppBoundDomains`](Reference.md#limitsNavigationsToAppBoundDomains)
- [`autoManageStatusBarEnabled`](Reference.md#autoManageStatusBarEnabled)
- [`setSupportMultipleWindows`](Reference.md#setSupportMultipleWindows)
@@ -1314,6 +1315,25 @@ Example:
---
+### `limitsNavigationsToAppBoundDomains`[⬆](#props-index)
+
+If true indicates to WebKit that a WKWebView will only navigate to app-bound domains. Only applicable for iOS 14 or greater.
+
+Once set, any attempt to navigate away from an app-bound domain will fail with the error “App-bound domain failure.”
+Applications can specify up to 10 “app-bound” domains using a new Info.plist key `WKAppBoundDomains`. For more information see [App-Bound Domains](https://webkit.org/blog/10882/app-bound-domains/).
+
+| Type | Required | Platform |
+| ------- | -------- | -------- |
+| boolean | No | iOS |
+
+Example:
+
+```jsx
+
+```
+
+---
+
### `autoManageStatusBarEnabled`
If set to `true`, the status bar will be automatically hidden/shown by WebView, specifically when full screen video is being watched. If `false`, WebView will not manage the status bar at all. The default value is `true`.
diff --git a/src/WebViewTypes.ts b/src/WebViewTypes.ts
index 574acf552..020db1617 100644
--- a/src/WebViewTypes.ts
+++ b/src/WebViewTypes.ts
@@ -332,6 +332,7 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
injectedJavaScriptForMainFrameOnly?: boolean;
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean;
onFileDownload?: (event: FileDownloadEvent) => void;
+ limitsNavigationsToAppBoundDomains?: boolean;
}
export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
@@ -614,6 +615,17 @@ export interface IOSWebViewProps extends WebViewSharedProps {
* If not provided, the default is to let the webview try to render the file.
*/
onFileDownload?: (event: FileDownloadEvent) => void;
+
+ /**
+ * A Boolean value which, when set to `true`, indicates to WebKit that a WKWebView
+ * will only navigate to app-bound domains. Once set, any attempt to navigate away
+ * from an app-bound domain will fail with the error “App-bound domain failure.”
+ *
+ * Applications can specify up to 10 “app-bound” domains using a new
+ * Info.plist key `WKAppBoundDomains`.
+ * @platform ios
+ */
+ limitsNavigationsToAppBoundDomains?: boolean;
}
export interface MacOSWebViewProps extends WebViewSharedProps {
From 06ffafc1bc45fc81cf780b20d835f14056655069 Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Tue, 16 Mar 2021 23:31:36 +0000
Subject: [PATCH 14/19] chore(release): 11.3.0 [skip ci]
# [11.3.0](https://github.com/react-native-webview/react-native-webview/compare/v11.2.6...v11.3.0) (2021-03-16)
### Features
* **ios:** Add support for `limitsNavigationsToAppBoundDomains` ([#1662](https://github.com/react-native-webview/react-native-webview/issues/1662)) ([7decc5c](https://github.com/react-native-webview/react-native-webview/commit/7decc5cff1de221ad729ab16f7b18901dc2f889a))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 7f7ab0493..d178f41a9 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.2.6",
+ "version": "11.3.0",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 65cc83c21a74cdf9a79626d55b10e1dee6d80424 Mon Sep 17 00:00:00 2001
From: crasyboy42
Date: Wed, 17 Mar 2021 00:32:14 +0100
Subject: [PATCH 15/19] fix(android:) enable DRM protected content (#1862)
---
.../com/reactnativecommunity/webview/RNCWebViewManager.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
index 952e46ead..69459ee3a 100644
--- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
+++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
@@ -1139,6 +1139,8 @@ public void onPermissionRequest(final PermissionRequest request) {
permissions.add(Manifest.permission.RECORD_AUDIO);
} else if (requestedResources[i].equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {
permissions.add(Manifest.permission.CAMERA);
+ } else if(requestedResources[i].equals(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)) {
+ permissions.add(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID);
}
// TODO: RESOURCE_MIDI_SYSEX, RESOURCE_PROTECTED_MEDIA_ID.
}
@@ -1151,6 +1153,8 @@ public void onPermissionRequest(final PermissionRequest request) {
grantedPermissions.add(PermissionRequest.RESOURCE_AUDIO_CAPTURE);
} else if (permissions.get(i).equals(Manifest.permission.CAMERA)) {
grantedPermissions.add(PermissionRequest.RESOURCE_VIDEO_CAPTURE);
+ } else if (permissions.get(i).equals(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)) {
+ grantedPermissions.add(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID);
}
}
From ac8eb97910212e64930b5f3a72142f062ef71329 Mon Sep 17 00:00:00 2001
From: Alexander Sklar
Date: Tue, 16 Mar 2021 16:40:31 -0700
Subject: [PATCH 16/19] fix(windows): Check UAP contract version before calling
FrameworkElement.IsLoaded (#1858)
Co-authored-by: Thibault Malbranche
---
windows/ReactNativeWebView.sln | 3 +--
.../ReactNativeWebView.vcxproj | 7 ++++---
windows/ReactNativeWebView/ReactWebView.cpp | 17 ++++++++++++++---
.../WebViewBridgeComponent.vcxproj | 1 +
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/windows/ReactNativeWebView.sln b/windows/ReactNativeWebView.sln
index b0f11da39..4af32309f 100644
--- a/windows/ReactNativeWebView.sln
+++ b/windows/ReactNativeWebView.sln
@@ -34,7 +34,7 @@ EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
- ..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
+ ..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore-Items.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
..\node_modules\react-native-windows\Mso\Mso.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4
@@ -44,7 +44,6 @@ Global
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
- ..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
diff --git a/windows/ReactNativeWebView/ReactNativeWebView.vcxproj b/windows/ReactNativeWebView/ReactNativeWebView.vcxproj
index 0f0ad05ad..46a756dcc 100644
--- a/windows/ReactNativeWebView/ReactNativeWebView.vcxproj
+++ b/windows/ReactNativeWebView/ReactNativeWebView.vcxproj
@@ -1,6 +1,6 @@
-
+
true
true
@@ -89,6 +89,7 @@
28204
_WINRT_DLL;%(PreprocessorDefinitions)
$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ stdcpp17
Console
@@ -153,7 +154,7 @@
-
+
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
@@ -161,4 +162,4 @@
-
+
\ No newline at end of file
diff --git a/windows/ReactNativeWebView/ReactWebView.cpp b/windows/ReactNativeWebView/ReactWebView.cpp
index 6127fbe7d..045cec4ac 100644
--- a/windows/ReactNativeWebView/ReactWebView.cpp
+++ b/windows/ReactNativeWebView/ReactWebView.cpp
@@ -5,8 +5,8 @@
#include "JSValueXaml.h"
#include "ReactWebView.h"
#include "ReactWebView.g.cpp"
-
-
+#include
+#include
namespace winrt {
using namespace Microsoft::ReactNative;
@@ -63,11 +63,22 @@ namespace winrt::ReactNativeWebView::implementation {
});
}
+ bool Is17763OrHigher() {
+ static std::optional hasUniversalAPIContract_v7;
+
+ if (!hasUniversalAPIContract_v7.has_value()) {
+ hasUniversalAPIContract_v7 = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
+ }
+ return hasUniversalAPIContract_v7.value();
+ }
+
void ReactWebView::WriteWebViewNavigationEventArg(winrt::WebView const& sender, winrt::IJSValueWriter const& eventDataWriter) {
auto tag = this->GetValue(winrt::FrameworkElement::TagProperty()).as().GetInt64();
WriteProperty(eventDataWriter, L"canGoBack", sender.CanGoBack());
WriteProperty(eventDataWriter, L"canGoForward", sender.CanGoForward());
- WriteProperty(eventDataWriter, L"loading", !sender.IsLoaded());
+ if (Is17763OrHigher()) {
+ WriteProperty(eventDataWriter, L"loading", !sender.IsLoaded());
+ }
WriteProperty(eventDataWriter, L"target", tag);
WriteProperty(eventDataWriter, L"title", sender.DocumentTitle());
if (auto uri = sender.Source()) {
diff --git a/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj b/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj
index 21003647d..68a6b771a 100644
--- a/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj
+++ b/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj
@@ -95,6 +95,7 @@
_WINRT_DLL;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)
$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
+ stdcpp17
Console
From 991f6b790295105ec6d7ae8ed0b5abf7fda554d7 Mon Sep 17 00:00:00 2001
From: semantic-release-bot
Date: Tue, 16 Mar 2021 23:42:08 +0000
Subject: [PATCH 17/19] chore(release): 11.3.1 [skip ci]
## [11.3.1](https://github.com/react-native-webview/react-native-webview/compare/v11.3.0...v11.3.1) (2021-03-16)
### Bug Fixes
* **windows:** Check UAP contract version before calling FrameworkElement.IsLoaded ([#1858](https://github.com/react-native-webview/react-native-webview/issues/1858)) ([ac8eb97](https://github.com/react-native-webview/react-native-webview/commit/ac8eb97910212e64930b5f3a72142f062ef71329))
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index d178f41a9..6f48e5b30 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"Thibault Malbranche "
],
"license": "MIT",
- "version": "11.3.0",
+ "version": "11.3.1",
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
From 2973a50d7e1ec34b141550d9f607d4d1c346cd1f Mon Sep 17 00:00:00 2001
From: Daniel Winkler
Date: Wed, 17 Mar 2021 23:23:57 +0100
Subject: [PATCH 18/19] chore(docs): Add multiDex error to the common issues
section (#1921)
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index d38985197..8911bfc00 100644
--- a/README.md
+++ b/README.md
@@ -76,6 +76,7 @@ For more, read the [API Reference](./docs/Reference.md) and [Guide](./docs/Guide
## Common issues
- If you're getting `Invariant Violation: Native component for "RNCWebView does not exist"` it likely means you forgot to run `react-native link` or there was some error with the linking process
+- If you encounter a build error during the task `:app:mergeDexRelease`, you need to enable multidex support in `android/app/build.gradle` as discussed in [this issue](https://github.com/react-native-webview/react-native-webview/issues/1344#issuecomment-650544648)
## Contributing
From 9d9fda87fa82e22c732cbecede565c6d399bb707 Mon Sep 17 00:00:00 2001
From: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com>
Date: Mon, 22 Mar 2021 08:01:18 -0700
Subject: [PATCH 19/19] chore(docs): Update Instructions for Windows WebView
Scrolling (#1927)
* Update with Windows Scroll with Touch Requirements
* Rephrase
---
docs/Getting-Started.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/Getting-Started.md b/docs/Getting-Started.md
index 8631a4843..3de306ad4 100644
--- a/docs/Getting-Started.md
+++ b/docs/Getting-Started.md
@@ -83,6 +83,8 @@ Add `#include "winrt/ReactNativeWebView.h"`.
Add `PackageProviders().Append(winrt::ReactNativeWebView::ReactPackageProvider());` before `InitializeComponent();`.
+Note if you want to enable scroll with Touch for the WebView component you must disable perspective for your app using [ReactRootView.IsPerspectiveEnabled](https://microsoft.github.io/react-native-windows/docs/ReactRootView#isperspectiveenabled).
+
## 3. Import the webview into your component
```js