Fix floating date header when not scrolling

This commit is contained in:
ayumi-signal 2023-11-02 00:05:35 -07:00 committed by GitHub
parent b2d4e8cd56
commit 8f6fe60342
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,6 +243,13 @@ export class Timeline extends React.Component<
if (event.isTrusted) {
this.scrollerLock.onUserInterrupt('onScroll');
}
// hasRecentlyScrolled is used to show the floating date header, which we only
// want to show when scrolling through history or on conversation first open.
// Checking bottom prevents new messages and typing from showing the header.
if (!this.state.hasRecentlyScrolled && this.isAtBottom()) {
return;
}
this.setState(oldState =>
// `onScroll` is called frequently, so it's performance-sensitive. We try our best
// to return `null` from this updater because [that won't cause a re-render][0].