From 8f6fe6034221d1c013e7e7bf07afe6cef6f047fe Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Thu, 2 Nov 2023 00:05:35 -0700 Subject: [PATCH] Fix floating date header when not scrolling --- ts/components/conversation/Timeline.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ts/components/conversation/Timeline.tsx b/ts/components/conversation/Timeline.tsx index 1a83055e27..f3c1995c5f 100644 --- a/ts/components/conversation/Timeline.tsx +++ b/ts/components/conversation/Timeline.tsx @@ -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].