fix(android): possible NullPointerException (#965)

This commit is contained in:
thanakij 2019-10-22 14:56:50 +07:00 committed by Thibault Malbranche
parent f1479ee26a
commit fab77dc82f
1 changed files with 1 additions and 6 deletions

View File

@ -280,13 +280,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
@ReactProp(name = "androidHardwareAccelerationDisabled")
public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
ReactContext reactContext = (ReactContext) view.getContext();
final boolean isHardwareAccelerated = (reactContext.getCurrentActivity().getWindow()
.getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
if (disabled || !isHardwareAccelerated) {
if (disabled) {
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
} else {
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
}