Merge pull request #1091 from gh123man/fix-keyboard-cover-text

Don't cover messages when keyboard is presented
This commit is contained in:
Garth Vander Houwen 2025-02-11 08:02:58 -08:00 committed by GitHub
commit 86a987b735
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View file

@ -127,13 +127,17 @@ struct ChannelMessageList: View {
}
}
}
.padding([.top])
.scrollDismissesKeyboard(.immediately)
.scrollDismissesKeyboard(.interactively)
.onFirstAppear {
withAnimation {
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)
}
}
.onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardDidShowNotification)) { _ in
withAnimation {
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)
}
}
.onChange(of: channel.allPrivateMessages) {
withAnimation {
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)

View file

@ -115,13 +115,17 @@ struct UserMessageList: View {
}
}
}
.padding([.top])
.scrollDismissesKeyboard(.immediately)
.scrollDismissesKeyboard(.interactively)
.onFirstAppear {
withAnimation {
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)
}
}
.onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardDidShowNotification)) { _ in
withAnimation {
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)
}
}
.onChange(of: user.messageList) {
withAnimation {
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)