Check for messages

This commit is contained in:
Garth Vander Houwen 2022-03-07 21:30:18 -08:00
parent 73fbfa2736
commit b6054fdc25

View file

@ -335,17 +335,20 @@ struct UserMessageList: View {
self.bleManager.context = context
self.bleManager.userSettings = userSettings
if allMessages.count > 0 {
if allMessages.count > 1 {
withAnimation(Animation.spring().delay(0.5)) {
withAnimation(Animation.spring().delay(1)) {
scrollView.scrollTo(allMessages.firstIndex(of: allMessages.last! ), anchor: .bottom)
}
}
})
.onChange(of: allMessages.count, perform: { count in
withAnimation(Animation.spring().delay(0.5)) {
scrollView.scrollTo(allMessages.firstIndex(of: allMessages.last! ), anchor: .bottom)
if count > 1 {
withAnimation(Animation.spring().delay(1)) {
scrollView.scrollTo(allMessages.firstIndex(of: allMessages.last! ), anchor: .bottom)
}
}
})
}