jarden-digital / react-native-recaptchav3

Haskkor/react-native-recaptchav3
MIT License
47 stars 76 forks source link

WebView crashes when it gets loaded on emulator for the second time #14

Open Invertisment opened 3 years ago

Invertisment commented 3 years ago

When I test my app on emulator (API 30 with Android 10.0+) I can't load the component for the second time. It crashes the app and I can't catch the error using ErrorBoundary component.

It doesn't crash on a real Android device (Android 7.0 which would be API 21 and no updated Chromium WebView) no matter how many times I reload the captcha component. So it's related to the emulator or versions of Android libraries in it.

I found these issues which say that that there is an issue with current Chrome: https://github.com/rishichawda/react-native-qrcode-generator/issues/23 https://github.com/react-native-webview/react-native-webview/issues/429#issuecomment-747811636

Is it fine to have a small PR that applies their fixes?

Invertisment commented 3 years ago

It doesn't crash if emulator has API 27

catalinberta commented 3 years ago

I confirm the same scenario. If the component is reloaded (upon navigation) to regenerate the token, it crashes on Android, but not on iOS.

Invertisment commented 3 years ago

Also opacity and hardware acceleration fixes don't work to fix this one.

catalinberta commented 3 years ago

Adding androidHardwareAccelerationDisabled to the WebView component fixed it for me. Though I reckon this is just a temporary solution until react-native-webview fixes this. Problem is that react-native-recaptchav3 does not expose props for the webview or its container. This would be a good occasion to add them

amitmehtacode commented 4 months ago

Use this

https://www.npmjs.com/package/react-native-secure-captcha-v3