From 221eabc49679c9cb8b511c2562c5320f99f5b718 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Fri, 16 Jul 2021 13:27:27 +1000 Subject: [PATCH] fix scroll to button not always works --- Session/Conversations/ConversationVC+Interaction.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 795cc80ae..23b17d9ee 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -18,7 +18,10 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc } func handleScrollToBottomButtonTapped() { - scrollToBottom(isAnimated: true) + // The tableview's content size will be calculated by the estimated height of cells, + // so the result may be inaccurate before all the cells are loaded. + // Use this scroll to the last row instead. + messagesTableView.scrollToRow(at: IndexPath(row: viewItems.count-1, section: 0), at: .top, animated: true) } // MARK: Blocking