[英]How to show html in react native webView?
I'm using a webView for rendering a piece of html but instead of rendering it shows the code.我正在使用 webView 来渲染一块 html 但不是渲染它而是显示代码。 What is the problem?
问题是什么?
My code is...我的代码是...
<WebView
source = {scoLocal['sco']}
javaScriptCanOpenWindowsAutomatically={true}
javaScriptEnabled={true}
domStorageEnabled={true}
style={[styles.textArea, {
width: '100%',
height: '100%',
maxHeight: '100%',
maxWidth: '100%'
}]}
/>
Maybe you should show the scoLocal, probably that is the reason you are getting an error.也许您应该显示 scoLocal,这可能是您收到错误的原因。 The general usage is shown below.
一般用法如下所示。
<WebView
originWhitelist={['*']}
source={{ html: '<p>This is an HTML p tag</p>' }}
/>
or或者
const htmlSource = '<p>This is an HTML p tag</p>'
<WebView
originWhitelist={['*']}
source={{ html: htmlSource }}
/>
Have a nice one!有一个美好的!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.