Improved HTML parsing
This commit is contained in:
parent
82371e89e7
commit
b6915a1ebe
1 changed files with 11 additions and 1 deletions
|
@ -21,15 +21,25 @@ class CustomHTML extends React.Component<Props> {
|
||||||
return <Text {...passProps}>{children}</Text>;
|
return <Text {...passProps}>{children}</Text>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getListBullet = (htmlAttribs, children, convertedCSSStyles, passProps) => {
|
||||||
|
return (
|
||||||
|
<Text>- </Text>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
// Surround description with p to allow text styling if the description is not html
|
// Surround description with p to allow text styling if the description is not html
|
||||||
return <HTML
|
return <HTML
|
||||||
html={"<p>" + this.props.html + "</p>"}
|
html={"<p>" + this.props.html + "</p>"}
|
||||||
renderers={{
|
renderers={{
|
||||||
p: this.getBasicText,
|
p: this.getBasicText,
|
||||||
|
li: this.getBasicText,
|
||||||
}}
|
}}
|
||||||
|
listsPrefixesRenderers={{
|
||||||
|
ul: this.getListBullet
|
||||||
|
}}
|
||||||
|
ignoredTags={['img']}
|
||||||
ignoredStyles={['color', 'background-color']}
|
ignoredStyles={['color', 'background-color']}
|
||||||
|
|
||||||
onLinkPress={this.openWebLink}/>;
|
onLinkPress={this.openWebLink}/>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue