[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 <gerzonc@icloud.com>
Co-authored-by: Gerzon Z <gerzonzcanario@gmail.com>
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Reinaldo Neto 2021-07-02 16:17:47 -03:00 committed by GitHub
parent 58d21be195
commit 300c1f96f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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();
};

View File

@ -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) {