From ffc12f3e7449e7ff021ffd66d7e4a6f17cee3048 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Tue, 16 Jul 2019 15:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=E6=97=A5=E8=AE=B0?= =?UTF-8?q?=E6=9C=AC=E8=AF=A6=E6=83=85=E9=A1=B5loading,=20=E7=A9=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=8F=90=E7=A4=BA=202.=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=8F=90=E9=86=92=E5=88=B0=E6=97=A5=E8=AE=B0=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E6=97=B6=EF=BC=8C=E6=8F=90=E9=86=92=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=EF=BC=8C=E6=BB=9A=E5=8A=A8=E5=88=B0=E5=BA=95?= =?UTF-8?q?=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/comment/comment.js | 7 ++++++- src/component/comment/commentList.js | 2 ++ src/component/loading.js | 2 +- src/component/notebook/notebookDiaryList.js | 20 +++++++++++++++++++ .../notification/notificationList.js | 4 +++- src/page/DiaryDetailPage.js | 2 +- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/component/comment/comment.js b/src/component/comment/comment.js index 89ea4a1..c399883 100644 --- a/src/component/comment/comment.js +++ b/src/component/comment/comment.js @@ -30,8 +30,13 @@ export default class Comment extends Component { let isMyComment = this.state.isMyComment; let expired = this.state.expired; + const isNewComment = this.props.newCommentIds != null + && this.props.newCommentIds.some(it => it === comment.id); + + const bgActive = isNewComment ? {backgroundColor: Color.textSelect} : null; + return ( - + diff --git a/src/component/comment/commentList.js b/src/component/comment/commentList.js index e9b1a8b..d24b944 100644 --- a/src/component/comment/commentList.js +++ b/src/component/comment/commentList.js @@ -149,6 +149,8 @@ export default class CommentList extends Component { return ( this._onCommentPress(item)}> { this.setState({ + mounting: false, refreshing: false }); }); @@ -210,6 +215,21 @@ export default class NotebookDiaryList extends Component { return null; } + if(this.state.refreshing) { + return (); + } + + if(!this.state.mounting && (!this.state.diaries || this.state.diaries.length == 0)) { + return ( + + ); + } + let expired = this.notebook.isExpired; let isMine = this.isMine; diff --git a/src/component/notification/notificationList.js b/src/component/notification/notificationList.js index 82b8533..5db4564 100644 --- a/src/component/notification/notificationList.js +++ b/src/component/notification/notificationList.js @@ -115,7 +115,9 @@ export default class NotificationList extends Component { } }, passProps: { - diaryId: msg.link_id + diaryId: msg.link_id, + newCommentIds: msg.list.map(it => it.content.comment_id), + needScrollToBottom: true } } }); diff --git a/src/page/DiaryDetailPage.js b/src/page/DiaryDetailPage.js index 289deb7..a426037 100644 --- a/src/page/DiaryDetailPage.js +++ b/src/page/DiaryDetailPage.js @@ -201,7 +201,7 @@ export default class DiaryDetailPage extends Component { this.scroll = r} style={{flex: 1}} onContentSizeChange={(width, height) => { - if(this.state.needScrollToBottom) { + if(this.props.needScrollToBottom || this.state.needScrollToBottom) { this.scroll.scrollTo({y: height}); this.setState({needScrollToBottom: false}); }