From 300c1f96f0d27c6d7490cff480e65f7cc48f31d6 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Fri, 2 Jul 2021 16:17:47 -0300 Subject: [PATCH] [FIX] Jump to message from in-app notification (#3225) * [FIX] Jump to message by in-app notification * Bug fix to scroll proper the last message * Minor tweak Co-authored-by: Gerzon Z Co-authored-by: Gerzon Z Co-authored-by: Diego Mello --- app/containers/InAppNotification/NotifierComponent.js | 4 ++-- app/views/RoomView/List/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/containers/InAppNotification/NotifierComponent.js b/app/containers/InAppNotification/NotifierComponent.js index b69704359..6268cd098 100644 --- a/app/containers/InAppNotification/NotifierComponent.js +++ b/app/containers/InAppNotification/NotifierComponent.js @@ -76,7 +76,7 @@ const NotifierComponent = React.memo(({ notification, isMasterDetail }) => { const { title = name, avatar = name } = notification; const onPress = () => { - const { prid } = payload; + const { prid, _id } = payload; if (!rid) { return; } @@ -89,7 +89,7 @@ const NotifierComponent = React.memo(({ notification, isMasterDetail }) => { } else { Navigation.navigate('RoomsListView'); } - goRoom({ item, isMasterDetail }); + goRoom({ item, isMasterDetail, jumpToMessageId: _id }); hideNotification(); }; diff --git a/app/views/RoomView/List/index.js b/app/views/RoomView/List/index.js index 19a8ccb90..cbf02879b 100644 --- a/app/views/RoomView/List/index.js +++ b/app/views/RoomView/List/index.js @@ -269,7 +269,7 @@ class ListContainer extends React.Component { const { listRef } = this.props; const index = messages.findIndex(item => item.id === messageId); if (index > -1) { - listRef.current.getNode().scrollToIndex({ index, viewPosition: 0.5 }); + listRef.current.getNode().scrollToIndex({ index, viewPosition: 0.5, viewOffset: 100 }); await new Promise(res => setTimeout(res, 300)); if (!this.viewableItems.map(vi => vi.key).includes(messageId)) { if (!this.jumping) {