React Native: Opening a WebView modal over a WebView on android freezes the underlying WebView after closing the modal

Viewed 671

I've created a react native app where one screen is a WebView form where pressing a button opens up a custom made Modal whose content is another WebView, thereby allowing the user to navigate away from the form and return to it without having to restart filling out the form again.

When you close this Modal everything functions correctly on iOS, but on Android the underlying WebView becomes either a blank screen or frozen when you close the Modal.

I suspect that this may be an issue with the native Android WebView, but I am unfamiliar with the Android ecosystem. Can you have 2 WebViews stacked on top of each other in Android?

1 Answers

I have the same issue, and I found in my case that the stopLoading method for webview previous to open the modal causes the freeze, but I haven't found why this happens. A workaround that I found to skip this bug is to use onShouldStartLoadWithRequest to catch the url to open in modal and return false to stop the main webview loading without causing the freeze.

Related