|
@@ -107,6 +107,7 @@ import javax.annotation.Nullable;
|
107
|
107
|
@ReactModule(name = RNCWebViewManager.REACT_CLASS)
|
108
|
108
|
public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
109
|
109
|
|
|
110
|
+ public static String activeUrl = null;
|
110
|
111
|
public static final int COMMAND_GO_BACK = 1;
|
111
|
112
|
public static final int COMMAND_GO_FORWARD = 2;
|
112
|
113
|
public static final int COMMAND_RELOAD = 3;
|
|
@@ -693,6 +694,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
693
|
694
|
|
694
|
695
|
@Override
|
695
|
696
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
697
|
+ activeUrl = url;
|
696
|
698
|
dispatchEvent(
|
697
|
699
|
view,
|
698
|
700
|
new TopShouldStartLoadWithRequestEvent(
|
|
@@ -847,9 +849,18 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
847
|
849
|
@Override
|
848
|
850
|
public void onProgressChanged(WebView webView, int newProgress) {
|
849
|
851
|
super.onProgressChanged(webView, newProgress);
|
|
852
|
+ final String url = webView.getUrl();
|
|
853
|
+ if (
|
|
854
|
+ url != null
|
|
855
|
+ && activeUrl != null
|
|
856
|
+ && !url.equals(activeUrl)
|
|
857
|
+ ) {
|
|
858
|
+ return;
|
|
859
|
+ }
|
850
|
860
|
WritableMap event = Arguments.createMap();
|
851
|
861
|
event.putDouble("target", webView.getId());
|
852
|
862
|
event.putString("title", webView.getTitle());
|
|
863
|
+ event.putString("url", url);
|
853
|
864
|
event.putBoolean("canGoBack", webView.canGoBack());
|
854
|
865
|
event.putBoolean("canGoForward", webView.canGoForward());
|
855
|
866
|
event.putDouble("progress", (float) newProgress / 100);
|