1

I am using react-native-webview in my expo app. In development mode everything works fine, the WebView loads both URLs and local html files without any problem.

But when I build the app in release mode or test in preview mode, the WebView is not loading anything. I only see an error:

Error  : loading page
Domain : undefined
Error  : code: -1

react-native-webview version : "react-native-webview": "13.13.5",

<WebView
    ref={webviewRef}
    source={require("../webview/SpeechToText.html")}
    originWhitelist={['*']}
    onMessage={handleMessage}
    javaScriptEnabled={true}
    domStorageEnabled={true}
    mixedContentMode="always"
    style={{ width:0,height:0,opacity:0}}
/>

app.json :

{
  "expo": {
    "name": "Knowzup",
    "slug": "knowzup",
    "version": "1.0.0",
    "scheme": "knowzup",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "automatic",
    "newArchEnabled": true,
    "splash": {
      "image": "./assets/splash-icon.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.hypercodez.knowzup"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      },
      [...],
    },
    "plugins": [
      ...
    ],
  }
}

It happens for both remote URLs and local html files.

Has anyone faced this issue or know why WebView works in debug but breaks in release?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.