Преглед изворни кода

fix(android): possible NullPointerException (#965)

thanakij пре 5 година
родитељ
комит
fab77dc82f

+ 1
- 6
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Прегледај датотеку

@@ -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