react-native - Webview 以文本形式打开本地 html 文件
问题描述
如何使用 webview 打开本地 HTML 文件?我试图在项目的根目录中创建一个 HTML 文件并像这样添加它:
const indexHTML = require('./index.html');
const App = () => {
return (
<WebView
originWhitelist={['*']}
style={{flex: 1}}
source={indexHTML}
/>
);
};
但是 webview 将其作为文本文件打开。对不起我的语法不好。
解决方案
推荐阅读
- swift - 当输入为 nil 时,Swift input == nil 会产生 false
- javascript - 当父元素设置为阻塞时,如何将子元素显示属性设置为无
- python - 具有返回变量函数 Maya Python 的 ScriptJob
- node.js - 遵循指南后,材料表不会排序
- c# - 获取 Foundation.NSErrorException:错误域 = NSURLErrorDomain 代码 = -1009 “互联网连接似乎处于脱机状态。” 在 Xamarin 窗体 iOS 上
- javascript - 方法未在实例上定义,但在渲染期间在 .vue 文件中引用
- search - 如何设置用户在输入中输入的状态?
- spring - 使用 IAM 角色而不是秘密和访问密钥下载和上传文件
- c# - GMap 路线创建
- python - Pymongo:无法编码十进制类型的对象。十进制?