[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:
parent
58d21be195
commit
300c1f96f0
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue