Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 0949150

Browse files
committed
Fix jump to bottom button being always displayed in non-overflowing timelines
Signed-off-by: Šimon Brandner <[email protected]>
1 parent 0f8c35e commit 0949150

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/components/structures/RoomView.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ export interface IRoomState {
179179
// this is true if we are fully scrolled-down, and are looking at
180180
// the end of the live timeline. It has the effect of hiding the
181181
// 'scroll to bottom' knob, among a couple of other things.
182-
atEndOfLiveTimeline: boolean;
183-
// used by componentDidUpdate to avoid unnecessary checks
184-
atEndOfLiveTimelineInit: boolean;
182+
atEndOfLiveTimeline?: boolean;
185183
showTopUnreadMessagesBar: boolean;
186184
statusBarVisible: boolean;
187185
// We load this later by asking the js-sdk to suggest a version for us.
@@ -257,8 +255,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
257255
isPeeking: false,
258256
showRightPanel: false,
259257
joining: false,
260-
atEndOfLiveTimeline: true,
261-
atEndOfLiveTimelineInit: false,
262258
showTopUnreadMessagesBar: false,
263259
statusBarVisible: false,
264260
canReact: false,
@@ -692,9 +688,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
692688
// in render() prevents the ref from being set on first mount, so we try and
693689
// catch the messagePanel when it does mount. Because we only want the ref once,
694690
// we use a boolean flag to avoid duplicate work.
695-
if (this.messagePanel && !this.state.atEndOfLiveTimelineInit) {
691+
if (this.messagePanel && this.state.atEndOfLiveTimeline === undefined) {
696692
this.setState({
697-
atEndOfLiveTimelineInit: true,
698693
atEndOfLiveTimeline: this.messagePanel.isAtEndOfLiveTimeline(),
699694
});
700695
}
@@ -2102,7 +2097,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
21022097
}
21032098
let jumpToBottom;
21042099
// Do not show JumpToBottomButton if we have search results showing, it makes no sense
2105-
if (!this.state.atEndOfLiveTimeline && !this.state.searchResults) {
2100+
if (this.state.atEndOfLiveTimeline === false && !this.state.searchResults) {
21062101
jumpToBottom = (<JumpToBottomButton
21072102
highlight={this.state.room.getUnreadNotificationCount(NotificationCountType.Highlight) > 0}
21082103
numUnreadMessages={this.state.numUnreadMessages}

0 commit comments

Comments
 (0)