html怎么把view变成标签_前端小庙之 React-Native 里html标签转换(react-native-htmlview)...

耿学义
2023-12-01

【师傅,你知道我在想谁么?】

【昨天那个女施主。】

【你怎么知道。】

【我也在想。】

【那你怎么睡得着?】

【那是大方丈的闺女,想也白想。】

【师傅,那Vue怎么绑定HTML嘛】

【v-html,简单】

【哦,那react呢】

【用dangerouslySetInnerHTML,无趣】

【哦,那React-native呢】

【这。。。时间不早了,早点睡吧】

react-native-htmlview

使用react-native-htmlview将html 代码片段渲染为RN组件,还可以定制你喜欢的样式

import React from 'react';

import {StyleSheet} from 'react-native';

import HTMLView from 'react-native-htmlview';

class App extends React.Component {

render() {

const htmlContent = `

♥ nice job!

`;

return (

value={htmlContent}

stylesheet={styles}

/>

);

}

}

const styles = StyleSheet.create({

a: {

fontWeight: '300',

color: '#FF3366', // make links coloured pink

},

});

 类似资料: