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:
parent
f27c28d934
commit
7b71364a9c
|
@ -63,7 +63,6 @@ import com.facebook.react.common.MapBuilder;
|
||||||
import com.facebook.react.common.build.ReactBuildConfig;
|
import com.facebook.react.common.build.ReactBuildConfig;
|
||||||
import com.facebook.react.module.annotations.ReactModule;
|
import com.facebook.react.module.annotations.ReactModule;
|
||||||
import com.facebook.react.uimanager.SimpleViewManager;
|
import com.facebook.react.uimanager.SimpleViewManager;
|
||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
|
||||||
import com.facebook.react.uimanager.UIManagerModule;
|
import com.facebook.react.uimanager.UIManagerModule;
|
||||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||||
import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
|
import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
|
||||||
|
@ -166,13 +165,13 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||||
return REACT_CLASS;
|
return REACT_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) {
|
protected RNCWebView createRNCWebViewInstance(ReactContext reactContext) {
|
||||||
return new RNCWebView(reactContext);
|
return new RNCWebView(reactContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
protected WebView createViewInstance(ThemedReactContext reactContext) {
|
protected WebView createViewInstance(ReactContext reactContext) {
|
||||||
RNCWebView webView = createRNCWebViewInstance(reactContext);
|
RNCWebView webView = createRNCWebViewInstance(reactContext);
|
||||||
setupWebChromeClient(reactContext, webView);
|
setupWebChromeClient(reactContext, webView);
|
||||||
reactContext.addLifecycleEventListener(webView);
|
reactContext.addLifecycleEventListener(webView);
|
||||||
|
@ -589,7 +588,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// Do not register default touch emitter and let WebView implementation handle touches
|
||||||
view.setWebViewClient(new RNCWebViewClient());
|
view.setWebViewClient(new RNCWebViewClient());
|
||||||
}
|
}
|
||||||
|
@ -691,7 +690,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||||
@Override
|
@Override
|
||||||
public void onDropViewInstance(WebView webView) {
|
public void onDropViewInstance(WebView webView) {
|
||||||
super.onDropViewInstance(webView);
|
super.onDropViewInstance(webView);
|
||||||
((ThemedReactContext) webView.getContext()).removeLifecycleEventListener((RNCWebView) webView);
|
((ReactContext) webView.getContext()).removeLifecycleEventListener((RNCWebView) webView);
|
||||||
((RNCWebView) webView).cleanupCallbacksAndDestroy();
|
((RNCWebView) webView).cleanupCallbacksAndDestroy();
|
||||||
mWebChromeClient = null;
|
mWebChromeClient = null;
|
||||||
}
|
}
|
||||||
|
@ -1263,7 +1262,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||||
* Activity Context is required for creation of dialogs internally by WebView
|
* Activity Context is required for creation of dialogs internally by WebView
|
||||||
* Reactive Native needed for access to ReactNative internal system functionality
|
* Reactive Native needed for access to ReactNative internal system functionality
|
||||||
*/
|
*/
|
||||||
public RNCWebView(ThemedReactContext reactContext) {
|
public RNCWebView(ReactContext reactContext) {
|
||||||
super(reactContext);
|
super(reactContext);
|
||||||
this.createCatalystInstance();
|
this.createCatalystInstance();
|
||||||
progressChangedFilter = new ProgressChangedFilter();
|
progressChangedFilter = new ProgressChangedFilter();
|
||||||
|
|
|
@ -19,13 +19,13 @@ public class CustomWebViewManager extends RNCWebViewManager {
|
||||||
protected static class CustomWebViewClient extends RNCWebViewClient { }
|
protected static class CustomWebViewClient extends RNCWebViewClient { }
|
||||||
|
|
||||||
protected static class CustomWebView extends RNCWebView {
|
protected static class CustomWebView extends RNCWebView {
|
||||||
public CustomWebView(ThemedReactContext reactContext) {
|
public CustomWebView(ReactContext reactContext) {
|
||||||
super(reactContext);
|
super(reactContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) {
|
protected RNCWebView createRNCWebViewInstance(ReactContext reactContext) {
|
||||||
return new CustomWebView(reactContext);
|
return new CustomWebView(reactContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class CustomWebViewManager extends RNCWebViewManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
|
protected void addEventEmitters(ReactContext reactContext, WebView view) {
|
||||||
view.setWebViewClient(new CustomWebViewClient());
|
view.setWebViewClient(new CustomWebViewClient());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class CustomWebViewManager extends RNCWebViewManager {
|
||||||
...
|
...
|
||||||
|
|
||||||
protected static class CustomWebView extends RNCWebView {
|
protected static class CustomWebView extends RNCWebView {
|
||||||
public CustomWebView(ThemedReactContext reactContext) {
|
public CustomWebView(ReactContext reactContext) {
|
||||||
super(reactContext);
|
super(reactContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue