Browse Source

fix scroll position for long messages when keyboard appears

cyberta 3 years ago
parent
commit
01d0ccedb7
1 changed files with 4 additions and 4 deletions
  1. 4 4
      deltachat-ios/Chat/ChatViewController.swift

+ 4 - 4
deltachat-ios/Chat/ChatViewController.swift

@@ -1075,7 +1075,7 @@ class ChatViewController: UITableViewController {
                 guard let self = self else { return }
                 let numberOfRows = self.tableView.numberOfRows(inSection: 0)
                 if numberOfRows > 0 {
-                    self.scrollToRow(at: IndexPath(row: numberOfRows - 1, section: 0), animated: animated, focusWithVoiceOver: focusOnVoiceOver)
+                    self.scrollToRow(at: IndexPath(row: numberOfRows - 1, section: 0), position: .bottom, animated: animated, focusWithVoiceOver: focusOnVoiceOver)
                 }
             }
         }
@@ -1127,9 +1127,9 @@ class ChatViewController: UITableViewController {
         }
     }
 
-    private func scrollToRow(at indexPath: IndexPath, animated: Bool, focusWithVoiceOver: Bool = true) {
+    private func scrollToRow(at indexPath: IndexPath, position: UITableView.ScrollPosition = .top, animated: Bool, focusWithVoiceOver: Bool = true) {
         if UIAccessibility.isVoiceOverRunning && focusWithVoiceOver {
-            self.tableView.scrollToRow(at: indexPath, at: .top, animated: false)
+            self.tableView.scrollToRow(at: indexPath, at: position, animated: false)
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: { [weak self] in
                 guard let self = self else { return }
                 UIAccessibility.post(notification: .screenChanged, argument: self.tableView.cellForRow(at: indexPath))
@@ -1137,7 +1137,7 @@ class ChatViewController: UITableViewController {
                 self.updateScrollDownButtonVisibility()
             })
         } else {
-            self.tableView.scrollToRow(at: indexPath, at: .top, animated: animated)
+            self.tableView.scrollToRow(at: indexPath, at: position, animated: animated)
         }
     }