Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/RoomView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ class RoomView extends React.Component {
if (handleCommandScroll(event)) {
const offset = input === 'UIKeyInputUpArrow' ? 100 : -100;
this.offset += offset;
this.flatList.scrollToOffset({ offset: this.offset });
this.flatList?.scrollToOffset({ offset: this.offset });
} else if (handleCommandRoomActions(event)) {
this.goRoomActionsView();
} else if (handleCommandSearchMessages(event)) {
Expand Down
24 changes: 9 additions & 15 deletions app/views/RoomsListView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,7 @@ class RoomsListView extends React.Component {
this.setHeader();
closeSearchHeader();
setTimeout(() => {
const offset = 0;
if (this.scroll.scrollTo) {
this.scroll.scrollTo({ x: 0, y: offset, animated: true });
} else if (this.scroll.scrollToOffset) {
this.scroll.scrollToOffset({ offset });
}
this.scrollToTop();
}, 200);
});
};
Expand Down Expand Up @@ -546,9 +541,7 @@ class RoomsListView extends React.Component {
search: result,
searching: true
});
if (this.scroll && this.scroll.scrollTo) {
this.scroll.scrollTo({ x: 0, y: 0, animated: true });
}
this.scrollToTop();
}, 300);

getRoomTitle = item => RocketChat.getRoomTitle(item)
Expand All @@ -569,15 +562,16 @@ class RoomsListView extends React.Component {
this.goRoom({ item, isMasterDetail });
};

scrollToTop = () => {
if (this.scroll?.scrollToOffset) {
this.scroll.scrollToOffset({ offset: 0 });
}
}

toggleSort = () => {
const { toggleSortDropdown } = this.props;

const offset = 0;
if (this.scroll.scrollTo) {
this.scroll.scrollTo({ x: 0, y: offset, animated: true });
} else if (this.scroll.scrollToOffset) {
this.scroll.scrollToOffset({ offset });
}
this.scrollToTop();
setTimeout(() => {
toggleSortDropdown();
}, 100);
Expand Down