Browse Source

fix(android): possible NullPointerException (#965)

thanakij 5 years ago
parent
commit
fab77dc82f

+ 1
- 6
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java View File

280
 
280
 
281
   @ReactProp(name = "androidHardwareAccelerationDisabled")
281
   @ReactProp(name = "androidHardwareAccelerationDisabled")
282
   public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
282
   public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
283
-    ReactContext reactContext = (ReactContext) view.getContext();
284
-    final boolean isHardwareAccelerated = (reactContext.getCurrentActivity().getWindow()
285
-        .getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
286
-    if (disabled || !isHardwareAccelerated) {
283
+    if (disabled) {
287
       view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
284
       view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
288
-    } else {
289
-      view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
290
     }
285
     }
291
   }
286
   }
292
 
287