reactjs - 有效的 CSS 未在 React Native WebView 的 HTML 中应用
问题描述
我有一个使用 html 和 css 制作的有效页面,当在浏览器上运行时,输出符合预期。我试图在 a 中呈现该 html 页面WebView
,但没有应用 CSS 样式,我不明白为什么。这就是我的做法:
public render() {
const css = `<style> /* ...all css styling goes here */ </style>`;
const html = `<body> /* ...all html goes here */ </body>`;
return (
<WebView
originWhitelist={["*"]}
source={{html: css + html}}
/>
);
}
我在这里想念什么?正如我所说,css 和 html 部分与页面中的完全一样,当我在浏览器中打开页面时,它工作得非常好。
解决方案
推荐阅读
- c - 使用带参数的 perror
- python-3.6 - Django 2.0 到 2.2 升级 centos7
- database - 如何按计数或等式过滤(Azure)Edm.String 集合?
- node.js - nodejs electronjs sqlite3 - 使用未声明的标识符'napi_is_detached_arraybuffer'
- python-3.x - 使用多个外键返回 sqlalchemy.exc.AmbiguousForeignKeysError
- reason - 我将如何编写一个通用函数来处理 ReScript 中的多种记录类型?
- php - centos7_aarch64下编译安装php7.4时出错
- java - 使用 switch 语句将随机数转换为字符串
- mongodb - 当我将网络访问更改为任何 IP 地址甚至包括我自己的 IP 地址时,为什么会出现错误?
- arcore - 写出 ARCore 位置数据?(增强面)