【发布时间】:2021-05-24 23:23:51
【问题描述】:
我是 android 开发的新手,我正在着手开发一个新的 android 应用程序。我目前正在android studio模拟器中使用react-native-webview测试expo,同时等待我的雇主给我发送适当的开发设备。我正在测试设置一个 iframe,它可以在应用程序中呈现我们现有的网站,并且一切都很顺利,直到我尝试通过 https 连接到从我的本地计算机提供的网站。我在 expos git 页面上看到 this issue 说他们将 this fix 拉到了 12 月的版本中,除了通过 https 连接到 10.0.2.2 时,它似乎在所有情况下对我都有效。我尝试在 android studio 中启用“接受所有证书”选项,但似乎也没有修复它。
这些 sn-ps 都可以正常渲染
<WebView source={{ uri: 'https://www.google.com/' }} />
<WebView source={{ uri: 'http://10.0.2.2/website/' }} />
<WebView source={{ uri: 'https://{alphaenvironment}.com/website/' }} />
虽然以下返回“SSL 错误:证书颁发机构不受信任”
<WebView source={{ uri: 'https://10.0.2.2/website/' }} />
这是我的 json 包
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^12.0.0",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "5.11.2",
"@react-navigation/native": "~5.8.10",
"@react-navigation/stack": "~5.12.8",
"expo": "~40.0.0",
"expo-asset": "~8.2.1",
"expo-constants": "~9.3.0",
"expo-font": "~8.4.0",
"expo-linking": "~2.0.0",
"expo-splash-screen": "~0.8.0",
"expo-status-bar": "~1.0.3",
"expo-web-browser": "~8.6.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-gesture-handler": "~1.8.0",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "~2.15.0",
"react-native-web": "~0.13.12",
"react-native-webview": "^11.0.0"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"@types/react": "~16.9.35",
"@types/react-native": "~0.63.2",
"jest-expo": "~40.0.0",
"typescript": "~4.0.0"
},
"private": true
}
谁能帮助这个菜鸟?
【问题讨论】:
标签: react-native android-studio expo react-native-webview