Message List: Fix losing scroll position in unread chats (follow-up)
This commit is contained in:
parent
bb75af6dcd
commit
95cfce6927
@ -471,8 +471,11 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
} else if (anchor) {
|
} else if (anchor) {
|
||||||
const newAnchorTop = anchor.getBoundingClientRect().top;
|
const newAnchorTop = anchor.getBoundingClientRect().top;
|
||||||
newScrollTop = scrollTop + (newAnchorTop - (anchorTopRef.current || 0));
|
newScrollTop = scrollTop + (newAnchorTop - (anchorTopRef.current || 0));
|
||||||
} else if (unreadDivider && !scrollOffset) {
|
} else if (unreadDivider) {
|
||||||
newScrollTop = unreadDivider.offsetTop - (hasTools ? UNREAD_DIVIDER_TOP_WITH_TOOLS : UNREAD_DIVIDER_TOP);
|
newScrollTop = Math.min(
|
||||||
|
unreadDivider.offsetTop - (hasTools ? UNREAD_DIVIDER_TOP_WITH_TOOLS : UNREAD_DIVIDER_TOP),
|
||||||
|
scrollHeight - scrollOffset,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
newScrollTop = scrollHeight - scrollOffset;
|
newScrollTop = scrollHeight - scrollOffset;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user