1.0.5 • Published 7 years ago

react-native-htmlparser v1.0.5

Weekly downloads
82
License
MIT
Repository
github
Last release
7 years ago

react-native-htmlparser

Why?

I did not find any working solution, so I looked for existing packages. None of them were working properly, so I decided to make my own from other packages' parts that I found interesting and usable. This package depends on @kodefox's parse5 react-native version, and is inspired by @siuying's htmltext.

Check their packages out:

Example

This is how you use it

import HtmlParser from 'react-native-htmlparser'

<HtmlParser containerStyle={{}} tagsStyle={{}} html={}/>
PropsTypeInformation
containerStylearrayStyle that will apply on the main View that wraps the parsed html
tagsStylearrayStyles that will be applied to their corresponding html tags (blocks and inlines)
htmlStringYour 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).

var tagsStyle = {
general: {
fontFamily: "Roboto"
},
p: {
marginBottom: 15
}
}