fix(android): Changing ThemedReactContext to ReactContext to allow custom stuff (#1994)

* changing ThemedReactContext to ReactContext

* updating documentation

Co-authored-by: Gaurav Gupta <gaurkum@microsoft.com>
This commit is contained in:
Gaurav Gupta 2021-05-20 13:50:42 +05:30 committed by GitHub
parent f27c28d934
commit 7b71364a9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -63,7 +63,6 @@ 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;
@ -166,13 +165,13 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
return REACT_CLASS;
}
protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) {
protected RNCWebView createRNCWebViewInstance(ReactContext reactContext) {
return new RNCWebView(reactContext);
}
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected WebView createViewInstance(ThemedReactContext reactContext) {
protected WebView createViewInstance(ReactContext reactContext) {
RNCWebView webView = createRNCWebViewInstance(reactContext);
setupWebChromeClient(reactContext, webView);
reactContext.addLifecycleEventListener(webView);
@ -589,7 +588,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
}
@Override
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
protected void addEventEmitters(ReactContext reactContext, WebView view) {
// Do not register default touch emitter and let WebView implementation handle touches
view.setWebViewClient(new RNCWebViewClient());
}
@ -691,7 +690,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@Override
public void onDropViewInstance(WebView webView) {
super.onDropViewInstance(webView);
((ThemedReactContext) webView.getContext()).removeLifecycleEventListener((RNCWebView) webView);
((ReactContext) webView.getContext()).removeLifecycleEventListener((RNCWebView) webView);
((RNCWebView) webView).cleanupCallbacksAndDestroy();
mWebChromeClient = null;
}
@ -1263,7 +1262,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
* Activity Context is required for creation of dialogs internally by WebView
* Reactive Native needed for access to ReactNative internal system functionality
*/
public RNCWebView(ThemedReactContext reactContext) {
public RNCWebView(ReactContext reactContext) {
super(reactContext);
this.createCatalystInstance();
progressChangedFilter = new ProgressChangedFilter();

View File

@ -19,13 +19,13 @@ public class CustomWebViewManager extends RNCWebViewManager {
protected static class CustomWebViewClient extends RNCWebViewClient { }
protected static class CustomWebView extends RNCWebView {
public CustomWebView(ThemedReactContext reactContext) {
public CustomWebView(ReactContext reactContext) {
super(reactContext);
}
}
@Override
protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) {
protected RNCWebView createRNCWebViewInstance(ReactContext reactContext) {
return new CustomWebView(reactContext);
}
@ -35,7 +35,7 @@ public class CustomWebViewManager extends RNCWebViewManager {
}
@Override
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
protected void addEventEmitters(ReactContext reactContext, WebView view) {
view.setWebViewClient(new CustomWebViewClient());
}
}
@ -52,7 +52,7 @@ public class CustomWebViewManager extends RNCWebViewManager {
...
protected static class CustomWebView extends RNCWebView {
public CustomWebView(ThemedReactContext reactContext) {
public CustomWebView(ReactContext reactContext) {
super(reactContext);
}