From 9fa4fe2fa5701240e8d90b27829d4b3e1f8141f3 Mon Sep 17 00:00:00 2001 From: Nam Se Hyun Date: Wed, 3 Aug 2016 17:36:09 -0700 Subject: [PATCH] Stop Reload Android Webview On Same URL Before Summary: Because it is react, the url could be changed on redirection or some other ways. The iOS version's WebView has controled that on [here](https://github.com/facebook/react-native/blob/master/React/Views/RCTWebView.m#L106). But the Android's one is not. Check the url is same with privous url. If it is true, cancel loading. This logic is same with iOS's. the ```method``` hasn't compared. Test urls as we can. The Google Map(https://map.google.com) was one of the site which has occur error before this commit. related issue : #9121 Closes https://github.com/facebook/react-native/pull/9126 Differential Revision: D3663685 Pulled By: javache fbshipit-source-id: f38c9012ee077677543dafcea83c0778a4471bfa --- .../com/facebook/react/views/webview/ReactWebViewManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java index 19d394b6f..2eb92ba77 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java @@ -329,6 +329,10 @@ public class ReactWebViewManager extends SimpleViewManager { } if (source.hasKey("uri")) { String url = source.getString("uri"); + String previousUrl = view.getUrl(); + if (previousUrl != null && previousUrl.equals(url)) { + return; + } if (source.hasKey("method")) { String method = source.getString("method"); if (method.equals(HTTP_METHOD_POST)) {