react-native-htmltext 介绍
react-native-htmltext 可以用 HTML 像 Markup 一样,在 ReactNative 里创建程式化的文本。ReactNative
为程式化文本提供一个文本元素,用于取代 NSAttributedString,你可以创建嵌套的文本:
<Text style={{fontWeight: 'bold'}}> I am bold <Text style={{color: 'red'}}> and red </Text> </Text
示例:
输入:
render: function() { var html = `<p>Hello world <b>world</b> <i>foo</i> bar hahh</p>` return ( <View style={styles.container}> <HtmlText style={styles.welcome} html={html}></HtmlText> </View> ); }
输入:
render: function() { var html = `<blockquote><p>Hello world <b>world</b> <i>foo</i> <blockquote>bar hahh</blockquote></p></blockquote>` return ( <View style={styles.container}> <HtmlText style={styles.welcome} html={html}></HtmlText> </View> ); }
react-native-htmltext 官网
https://github.com/siuying/react-native-htmltext
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。