From e1b3071eb3b4e52e16fd6ea91fa5d5184e29c5ff Mon Sep 17 00:00:00 2001 From: ue Date: Mon, 5 Nov 2018 15:14:14 +0300 Subject: [PATCH] quick bugfix: --- .../postView/view/postDisplayStyles.js | 2 +- .../postView/view/postDisplayView.js | 21 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/postView/view/postDisplayStyles.js b/src/components/postView/view/postDisplayStyles.js index e4e896656..2828b66e5 100644 --- a/src/components/postView/view/postDisplayStyles.js +++ b/src/components/postView/view/postDisplayStyles.js @@ -18,7 +18,7 @@ export default EStyleSheet.create({ flexDirection: 'row', }, scroll: { - height: '$deviceHeight / 1.113', + height: '$deviceHeight / 1.135', }, footer: { flexDirection: 'column', diff --git a/src/components/postView/view/postDisplayView.js b/src/components/postView/view/postDisplayView.js index 5ce5422ff..5349ac5c6 100644 --- a/src/components/postView/view/postDisplayView.js +++ b/src/components/postView/view/postDisplayView.js @@ -27,6 +27,7 @@ class PostDisplayView extends Component { this.state = { postHeight: 0, scrollHeight: 0, + isLoadedComments: false, }; } @@ -105,9 +106,12 @@ class PostDisplayView extends Component { render() { const { post, currentUser } = this.props; - const { postHeight, scrollHeight } = this.state; + const { postHeight, scrollHeight, isLoadedComments } = this.state; const isPostEnd = scrollHeight > postHeight; + const isGetComment = scrollHeight + 300 > postHeight; + + isGetComment && !isLoadedComments && this.setState({ isLoadedComments: true }); return ( @@ -141,13 +145,14 @@ class PostDisplayView extends Component { )} - {post && ( - + {post + && (isGetComment || isLoadedComments) && ( + )} {!isPostEnd && this._getTabBar(true)}