Skip to content

Commit

Permalink
feat(MessageComposeView): Scroll to top when autocompletion is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinperignon committed Jul 7, 2023
1 parent fbd4953 commit 213b715
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Mail/Views/New Message/ComposeMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ struct ComposeMessageView: View {
let rect = CGRect(x: 0, y: realPosition, width: 1, height: 1)
scrollView.scrollRectToVisible(rect, animated: true)
}
.onChange(of: autocompletionType) { newValue in
guard newValue != nil else { return }

let rectTop = CGRect(x: 0, y: 0, width: 1, height: 1)
scrollView?.scrollRectToVisible(rectTop, animated: true)
}
.navigationTitle(MailResourcesStrings.Localizable.buttonNewMessage)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
Expand Down

0 comments on commit 213b715

Please sign in to comment.