Message List: Fix scrolling to new message from bot
This commit is contained in:
parent
1c4475d590
commit
d509583a0c
@ -95,7 +95,7 @@ type StateProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const MESSAGE_REACTIONS_POLLING_INTERVAL = 15 * 1000;
|
const MESSAGE_REACTIONS_POLLING_INTERVAL = 15 * 1000;
|
||||||
const BOTTOM_THRESHOLD = 20;
|
const BOTTOM_THRESHOLD = 50;
|
||||||
const UNREAD_DIVIDER_TOP = 10;
|
const UNREAD_DIVIDER_TOP = 10;
|
||||||
const UNREAD_DIVIDER_TOP_WITH_TOOLS = 60;
|
const UNREAD_DIVIDER_TOP_WITH_TOOLS = 60;
|
||||||
const SCROLL_DEBOUNCE = 200;
|
const SCROLL_DEBOUNCE = 200;
|
||||||
@ -382,7 +382,7 @@ const MessageList: FC<OwnProps & StateProps> = ({
|
|||||||
let bottomOffset = scrollOffset - (prevContainerHeight || offsetHeight);
|
let bottomOffset = scrollOffset - (prevContainerHeight || offsetHeight);
|
||||||
if (wasMessageAdded) {
|
if (wasMessageAdded) {
|
||||||
// If two new messages come at once (e.g. when bot responds) then the first message will update `scrollOffset`
|
// If two new messages come at once (e.g. when bot responds) then the first message will update `scrollOffset`
|
||||||
// right away (before animation) which creates inconsistency until the animation completes. To workaround that,
|
// right away (before animation) which creates inconsistency until the animation completes. To work around that,
|
||||||
// we calculate `isAtBottom` with a "buffer" of the latest message height (this is approximate).
|
// we calculate `isAtBottom` with a "buffer" of the latest message height (this is approximate).
|
||||||
const lastItemHeight = lastItemElement ? lastItemElement.offsetHeight : 0;
|
const lastItemHeight = lastItemElement ? lastItemElement.offsetHeight : 0;
|
||||||
bottomOffset -= lastItemHeight;
|
bottomOffset -= lastItemHeight;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user