html - 反应原生渲染 HTML-> 类样式不起作用
问题描述
嗨,我正在使用react-native-render-html 渲染 HTML。
var strHTML = ''
strHTML = `<html><head></head><body><div id="container"><div id="one"><h3>Sunny</h3><p>Developer</p><p>Ist Floor, Shubham Complex, Ghatlodiya</p><p>Ahmedabad, Gujarat 380061</p></div><div id="two"><h3>9999999</h3><p>Specification </p></div></div></body></html>`
<ScrollView style={{ flex: 1 }}>
<HTML html={htmlContent} tagsStyles={tagsStyles} classesStyles={classStyles} imagesMaxWidth={Dimensions.get('window').width} />
</ScrollView>
const styles = {
tagsStyles: {
p: {margin: 2},
h3: {margin: 2, color: 'red'}
}
};
const classStyles = {
"container": { height: 200, background: 'red'},
"one": { height: 200,float: 'left' },
"two": { marginLeft: 30,height: 200 }
};
但是 classStyles(container,one,two) 对此没有影响
解决方案
您需要更改html
ID
至
班级
推荐阅读
- python - 在 sqlalchemy 中插入具有默认值列的行
- excel - 将数据从办公室 JS 存储传递到查询和连接
- sql - 告诉我我缺少右括号 idk 为什么
- spring - Spring Cloud Data Flow:使用 Java DSL 定义的部署流
- javascript - 如何在 JavaScript 中添加暂停?
- xml - 如何在使用 Mulesoft 转换消息时跳过 csv 中的空行
- rust - 使用枚举和匹配的迭代二叉搜索树
- python - 如何计算熊猫行之间的条件百分比变化?
- c++ - 我的动态数组有问题 - 线程 1:EXC_BAD_ACCESS (code=1, address=0x0)
- python - c++ 中的 np.gradient 替代方案