From 8a45fcf7f9d95ca589b0af9413911cfa3d25338a Mon Sep 17 00:00:00 2001 From: Thibault Malbranche Date: Fri, 21 May 2021 01:26:56 +0200 Subject: [PATCH] fix(android): revert change ThemedReactContext to ReactContext --- .../webview/RNCWebViewManager.java | 11 ++++++----- docs/Custom-Android.md | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java index 0a939ff..aa19044 100644 --- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java @@ -66,6 +66,7 @@ import com.facebook.react.common.MapBuilder; import com.facebook.react.common.build.ReactBuildConfig; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.SimpleViewManager; +import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.events.ContentSizeChangeEvent; @@ -170,13 +171,13 @@ public class RNCWebViewManager extends SimpleViewManager { return REACT_CLASS; } - protected RNCWebView createRNCWebViewInstance(ReactContext reactContext) { + protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) { return new RNCWebView(reactContext); } @Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) - protected WebView createViewInstance(ReactContext reactContext) { + protected WebView createViewInstance(ThemedReactContext reactContext) { RNCWebView webView = createRNCWebViewInstance(reactContext); setupWebChromeClient(reactContext, webView); reactContext.addLifecycleEventListener(webView); @@ -593,7 +594,7 @@ public class RNCWebViewManager extends SimpleViewManager { } @Override - protected void addEventEmitters(ReactContext reactContext, WebView view) { + protected void addEventEmitters(ThemedReactContext reactContext, WebView view) { // Do not register default touch emitter and let WebView implementation handle touches view.setWebViewClient(new RNCWebViewClient()); } @@ -695,7 +696,7 @@ public class RNCWebViewManager extends SimpleViewManager { @Override public void onDropViewInstance(WebView webView) { super.onDropViewInstance(webView); - ((ReactContext) webView.getContext()).removeLifecycleEventListener((RNCWebView) webView); + ((ThemedReactContext) webView.getContext()).removeLifecycleEventListener((RNCWebView) webView); ((RNCWebView) webView).cleanupCallbacksAndDestroy(); mWebChromeClient = null; } @@ -1443,7 +1444,7 @@ public class RNCWebViewManager extends SimpleViewManager { * Activity Context is required for creation of dialogs internally by WebView * Reactive Native needed for access to ReactNative internal system functionality */ - public RNCWebView(ReactContext reactContext) { + public RNCWebView(ThemedReactContext reactContext) { super(reactContext); this.createCatalystInstance(); progressChangedFilter = new ProgressChangedFilter(); diff --git a/docs/Custom-Android.md b/docs/Custom-Android.md index cb1a3f6..2fdac6a 100644 --- a/docs/Custom-Android.md +++ b/docs/Custom-Android.md @@ -19,13 +19,13 @@ public class CustomWebViewManager extends RNCWebViewManager { protected static class CustomWebViewClient extends RNCWebViewClient { } protected static class CustomWebView extends RNCWebView { - public CustomWebView(ReactContext reactContext) { + public CustomWebView(ThemedReactContext reactContext) { super(reactContext); } } @Override - protected RNCWebView createRNCWebViewInstance(ReactContext reactContext) { + protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) { return new CustomWebView(reactContext); } @@ -35,7 +35,7 @@ public class CustomWebViewManager extends RNCWebViewManager { } @Override - protected void addEventEmitters(ReactContext reactContext, WebView view) { + protected void addEventEmitters(ThemedReactContext reactContext, WebView view) { view.setWebViewClient(new CustomWebViewClient()); } } @@ -52,7 +52,7 @@ public class CustomWebViewManager extends RNCWebViewManager { ... protected static class CustomWebView extends RNCWebView { - public CustomWebView(ReactContext reactContext) { + public CustomWebView(ThemedReactContext reactContext) { super(reactContext); }