Expo WebView Android doesn't work
See original GitHub issue🐛 Bug Report
WebView Android doesn’t work
The problem is that when I use WebView and want to load some html page or custom HTML with external .js files it is not shown on Android. It works with simple HTML tags but not when I use param - uri.
I have no problem with same code for iPhone XR but for Android there are a error:
Error loading page Domain: undefined Error Code: -1 Desctiption: net:ERR_CACHE_MISS
Environment
Expo CLI 3.21.5 environment info: System: OS: Windows 10 10.0.18363 Binaries: Node: 12.16.1 - C:\Program Files\nodejs\node.EXE npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.5.0.0 AI-191.8026.42.35.6010548 npmPackages: expo: ~37.0.3 => 37.0.12 react: ~16.9.0 => 16.9.0 react-dom: ~16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4 react-native-web: ~0.11.7 => 0.11.7
System: OS: Windows 10 10.0.18363 CPU: (4) x64 Intel® Core™ i7-5500U CPU @ 2.40GHz Memory: 3.22 GB / 7.90 GB Binaries: Node: 12.16.1 - C:\Program Files\nodejs\node.EXE npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.5.0.0 AI-191.8026.42.35.6010548 npmPackages: react: ~16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4 npmGlobalPackages: react-native-cli: 2.0.1
The code
import React from 'react';
import { WebView } from 'react-native-webview';
export default function App() {
return (
<WebView
automaticallyAdjustContentInsets={false}
source={{ uri: 'https://expo.io' }}
style={{ marginTop: 80, width: 300, height: 250 }}
originWhitelist={["*"]}
javaScriptEnabled={true}
startInLoadingState={true}
mixedContentMode={'always'}
thirdPartyCookiesEnabled={true}
scrollEnabled={true}
domStorageEnabled={true}
allowUniversalAccessFromFileURLs={true}
javaScriptEnabled={true}
/>
);
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
The same problem with android 5.0.1 and expo SDK 38 but it works fine on emulator with android 7 and same SDK
any updates regarding this issue?
I have the same problem.
Phone 1: ASUS_X014D Android: 5.1.1
Phone 2: Huawei P smart 2019 Android: 10
The code:
<WebView style={{ flex: 1 }} source={ Platform.OS === "ios" ? require("../../assets/map.html") : { uri: __DEV__ ? DEV_INDEX_FILE_ASSET_URI : INDEX_FILE_ASSET_URI } } originWhitelist={["*"]} ref={ref => (this.context.webView = ref)} javaScriptEnabled={true} mixedContentMode={"always"} onMessage={this.handleMessage} onLoadEnd={this.sendConnected} onLoad={this.loadEnd} />
System:
Expo CLI 3.21.5 environment info: System: OS: Linux 4.15 Linux Mint 19.2 (Tina) Shell: 5.4.2 - /bin/zsh Binaries: Node: 13.14.0 - /usr/bin/node npm: 6.14.4 - /usr/bin/npm npmPackages: expo: ^36.0.0 => 36.0.2 react: 16.9.0 => 16.9.0 react-dom: ^16.12.0 => 16.13.1 react-native: 0.61.5 => 0.61.5 react-navigation: ^2.12.1 => 2.18.3 npmGlobalPackages: expo-cli: 3.21.5
Is available resolve?