From 20666fd1313a25e0af6f74e1538a18a90ee296f1 Mon Sep 17 00:00:00 2001 From: u-e Date: Sun, 6 Jan 2019 20:55:55 +0300 Subject: [PATCH] fixed reblog title after upvode --- .../view/postHeaderDescription.js | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/components/postElements/headerDescription/view/postHeaderDescription.js b/src/components/postElements/headerDescription/view/postHeaderDescription.js index 1ab80bcef..b1d34adcf 100644 --- a/src/components/postElements/headerDescription/view/postHeaderDescription.js +++ b/src/components/postElements/headerDescription/view/postHeaderDescription.js @@ -18,10 +18,19 @@ const DEFAULT_IMAGE = require('../../../../assets/esteem.png'); class PostHeaderDescription extends PureComponent { constructor(props) { super(props); - this.state = {}; + this.state = { + reblogedBy: props.reblogedBy || null, + }; } // Component Life Cycles + componentWillReceiveProps(nextProps) { + const { reblogedBy } = this.props; + + if (reblogedBy !== nextProps.reblogedBy && !nextProps.reblogedBy) { + this.setState({ reblogedBy }); + } + } // Component Functions _handleOnUserPress = (username) => { @@ -43,16 +52,9 @@ class PostHeaderDescription extends PureComponent { render() { const { - avatar, - date, - isHideImage, - name, - reblogedBy, - reputation, - size, - tag, - tagOnPress, + avatar, date, isHideImage, name, reputation, size, tag, tagOnPress, } = this.props; + const { reblogedBy } = this.state; const _reputationText = `(${reputation})`; let _avatar; @@ -85,7 +87,9 @@ class PostHeaderDescription extends PureComponent { )} {date} - {!!reblogedBy && } + {!!reblogedBy && ( + + )} ); }