Skip to content

Commit c808625

Browse files
authored
Merge pull request #188 from alphasp/fix-text-component-props
Rerender htmlview when text component props is changed
2 parents 366d44d + 4a978e6 commit c808625

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

HTMLView.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ class HtmlView extends PureComponent {
5252
}
5353

5454
componentWillReceiveProps(nextProps) {
55-
if (this.props.value !== nextProps.value || this.props.stylesheet !== nextProps.stylesheet) {
56-
this.startHtmlRender(nextProps.value, nextProps.stylesheet);
55+
if (this.props.value !== nextProps.value || this.props.stylesheet !== nextProps.stylesheet || this.props.textComponentProps !== nextProps.textComponentProps) {
56+
this.startHtmlRender(nextProps.value, nextProps.stylesheet, nextProps.textComponentProps);
5757
}
5858
}
5959

6060
componentWillUnmount() {
6161
this.mounted = false;
6262
}
6363

64-
startHtmlRender(value, style) {
64+
startHtmlRender(value, style, textComponentProps) {
6565
const {
6666
addLineBreaks,
6767
onLinkPress,
@@ -89,6 +89,10 @@ class HtmlView extends PureComponent {
8989
}
9090
});
9191

92+
if (textComponentProps) {
93+
opts.textComponentProps = textComponentProps;
94+
}
95+
9296
htmlToElement(value, opts, (err, element) => {
9397
if (err) {
9498
onError(err);

0 commit comments

Comments
 (0)