Skip to content

Commit

Permalink
Merge pull request jsdf#188 from alphasp/fix-text-component-props
Browse files Browse the repository at this point in the history
Rerender htmlview when text component props is changed
  • Loading branch information
bas-ie authored Jan 9, 2018
2 parents 366d44d + 4a978e6 commit c808625
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions HTMLView.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ class HtmlView extends PureComponent {
}

componentWillReceiveProps(nextProps) {
if (this.props.value !== nextProps.value || this.props.stylesheet !== nextProps.stylesheet) {
this.startHtmlRender(nextProps.value, nextProps.stylesheet);
if (this.props.value !== nextProps.value || this.props.stylesheet !== nextProps.stylesheet || this.props.textComponentProps !== nextProps.textComponentProps) {
this.startHtmlRender(nextProps.value, nextProps.stylesheet, nextProps.textComponentProps);
}
}

componentWillUnmount() {
this.mounted = false;
}

startHtmlRender(value, style) {
startHtmlRender(value, style, textComponentProps) {
const {
addLineBreaks,
onLinkPress,
Expand Down Expand Up @@ -89,6 +89,10 @@ class HtmlView extends PureComponent {
}
});

if (textComponentProps) {
opts.textComponentProps = textComponentProps;
}

htmlToElement(value, opts, (err, element) => {
if (err) {
onError(err);
Expand Down

0 comments on commit c808625

Please sign in to comment.