mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
New scroll methods
This commit is contained in:
parent
cc47e866c3
commit
f7c26f896f
2 changed files with 10 additions and 10 deletions
|
|
@ -128,14 +128,14 @@ struct ChannelMessageList: View {
|
|||
}
|
||||
.padding([.top])
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.onAppear {
|
||||
if channel.allPrivateMessages.count > 0 {
|
||||
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
|
||||
.onFirstAppear {
|
||||
withAnimation {
|
||||
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)
|
||||
}
|
||||
}
|
||||
.onChange(of: channel.allPrivateMessages, perform: { _ in
|
||||
if channel.allPrivateMessages.count > 0 {
|
||||
scrollView.scrollTo(channel.allPrivateMessages.last!.messageId)
|
||||
withAnimation {
|
||||
scrollView.scrollTo(channel.allPrivateMessages.last?.messageId ?? 0, anchor: .bottom)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,14 +116,14 @@ struct UserMessageList: View {
|
|||
}
|
||||
.padding([.top])
|
||||
.scrollDismissesKeyboard(.immediately)
|
||||
.onAppear {
|
||||
if user.messageList.count > 0 {
|
||||
scrollView.scrollTo(user.messageList.last!.messageId)
|
||||
.onFirstAppear {
|
||||
withAnimation {
|
||||
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)
|
||||
}
|
||||
}
|
||||
.onChange(of: user.messageList, perform: { _ in
|
||||
if user.messageList.count > 0 {
|
||||
scrollView.scrollTo(user.messageList.last!.messageId)
|
||||
withAnimation {
|
||||
scrollView.scrollTo(user.messageList.last?.messageId ?? 0, anchor: .bottom)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue