我在堆栈溢出上多次看到过这个问题,但没有明确的答案。我希望这个问题能对我和其他人有所帮助。
我希望使用react- native -webview在react native中呈现一个URL
我使用expo init my-app启动了一个空白的react原生项目。我运行了npm i react-native-webview和react-native link react-native-webview。然后,我创建了一个定义如下的文件
import React, { Component } from 'react';
import { WebView } from 'react-native-webview';
class WebViewTest extends Component {
render() {
return (
<WebView
source={{ uri: 'https://www.google.com/' }}
style={{ marginTop: 20, width: 400, height: 400 }}
/>
);
}
}
export default WebViewTest;我的app.js导入并呈现该文件,如下所示
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import WebViewTest from './Components/WebViewTest';
export default function App() {
return (
<WebViewTest />
);
}我通过运行expo start测试这段代码,并在web浏览器中打开我的项目。然后,我在浏览器中看到以下内容

我没有收到任何错误或警告,那么我哪里出错了?
发布于 2020-12-20 16:11:22
根据WebView的世博会文件-
https://docs.expo.io/versions/latest/sdk/webview/
https://www.npmjs.com/package/react-native-webview
它不能在使用EXPO的Web上工作
https://stackoverflow.com/questions/65312866
复制相似问题