fix(android): possible NullPointerException (#965)
This commit is contained in:
parent
f1479ee26a
commit
fab77dc82f
|
@ -280,13 +280,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||||
|
|
||||||
@ReactProp(name = "androidHardwareAccelerationDisabled")
|
@ReactProp(name = "androidHardwareAccelerationDisabled")
|
||||||
public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
|
public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
|
||||||
ReactContext reactContext = (ReactContext) view.getContext();
|
if (disabled) {
|
||||||
final boolean isHardwareAccelerated = (reactContext.getCurrentActivity().getWindow()
|
|
||||||
.getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
|
|
||||||
if (disabled || !isHardwareAccelerated) {
|
|
||||||
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
} else {
|
|
||||||
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue