Parse your HTML tags to react-native Text components
npm install react-native-htmlparserCheck their packages out:
- @kodefox - [react-native-parse-html]
- @siuying - [react-native-htmltext]
jsx
import HtmlParser from 'react-native-htmlparser'
`| Props | Type | Information | | |
|----------------|:--------:|-----------------------------------------------------------------------------------------|---|---|
| containerStyle | array | Style that will apply on the main View that wraps the parsed html | | |
| tagsStyle | array | Styles that will be applied to their corresponding html tags (blocks and inlines) | | |
| html | String | Your HTML content that needs to be parsed | | |
There is a special tag you can use, it's general. Its attributes will be applied to every html tags (block and inline tags).
`jsx
var tagsStyle = {
general: {
fontFamily: "Roboto"
},
p: {
marginBottom: 15
}
}
``[react-native-htmltext]:
[react-native-parse-html]: