Bladeren bron

fix(android): possible NullPointerException (#965)

thanakij 5 jaren geleden
bovenliggende
commit
fab77dc82f
1 gewijzigde bestanden met toevoegingen van 1 en 6 verwijderingen
  1. 1
    6
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java

+ 1
- 6
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Bestand weergeven

@@ -280,13 +280,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
280 280
 
281 281
   @ReactProp(name = "androidHardwareAccelerationDisabled")
282 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 284
       view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
288
-    } else {
289
-      view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
290 285
     }
291 286
   }
292 287