How to handle error page for on Android using Webview with React Native

On redirect, I get a brief flash of an error page on Android showing the following error before showing the correct screen.

Encountered an error loading page {"canGoBack": false, "canGoForward": false, "code": -6, "description": "net::ERR_CONNECTION_REFUSED", "loading": false, "target": 707, "title": "User details", "url": "http://localhost:3000/#error=access_denied

I have tried using onError and renderError to return a Loading component to replace the error screen but it’s not working. Anyone else having this problem or know how to resolve this?

    <WebView
      automaticallyAdjustContentInsets={false}
      source={{ uri }}
      javaScriptEnabled
      javaScriptEnabledAndroid
      onNavigationStateChange={(e) => handle(e)}
      onShouldStartLoadWithRequest={() => true}
      startInLoadingState={() => true}
      renderLoading={() => <Loading />}
      scalesPageToFit
      onError={() => <Loading />} // I have tried renderError={() => <Loading />} as well
    />

(It works perfectly fine on iOS)