|
@@ -259,10 +259,13 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
259
|
259
|
|
260
|
260
|
@ReactProp(name = "androidHardwareAccelerationDisabled")
|
261
|
261
|
public void setHardwareAccelerationDisabled(WebView view, boolean disabled) {
|
262
|
|
- if (disabled) {
|
|
262
|
+ ReactContext reactContext = (ReactContext) view.getContext();
|
|
263
|
+ final boolean isHardwareAccelerated = (reactContext.getCurrentActivity().getWindow()
|
|
264
|
+ .getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
|
|
265
|
+ if (disabled || !isHardwareAccelerated) {
|
263
|
266
|
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
264
|
267
|
} else {
|
265
|
|
- view.setLayerType(View.LAYER_TYPE_NONE, null);
|
|
268
|
+ view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
266
|
269
|
}
|
267
|
270
|
}
|
268
|
271
|
|