react-native-plotly icon indicating copy to clipboard operation
react-native-plotly copied to clipboard

Set androidLayerType on WebView to prevent crash on Android 12

Open endronk opened this issue 3 years ago • 2 comments

Issue

On Android 12 (I didn't test on Android 9), React Native Plotly always crashes with null pointer dereference issue (see crash log).

The same issue also occurred here (on Android 9): https://github.com/react-native-webview/react-native-webview/issues/1069

Solution

The issue can be solved by setting androidHardwareAccelerationDisabled to true. However, that prop has been deprecated (see this) and we should use androidLayerType instead.

The above solution has been tested on Android phone as well as emulator.

endronk avatar Feb 28 '22 08:02 endronk

I don't have any issues using this library on Android 12. If you need to set the androidLayerType for you use case, I would be ok if you made a prop for the Plotly component that is then passed into the webview, but I don't want to change the default.

rynobax avatar Mar 01 '22 02:03 rynobax

Sorry for the slow response. Yeah, I think it's a good idea. I will modify it on the weekend. It has something to do with the data that we pass to the WebView. So, for certain data, it causes crash. Thank you

endronk avatar Mar 10 '22 09:03 endronk