瀏覽代碼

fix(android): possible NullPointerException (#965)

thanakij 5 年之前
父節點
當前提交
fab77dc82f
共有 1 個檔案被更改,包括 1 行新增6 行删除
  1. 1
    6
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java

+ 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