From e0f0b4a0f749d2e83946f2c1297e5c97c9fdf46e Mon Sep 17 00:00:00 2001 From: Mike Robbins Date: Tue, 14 Oct 2025 17:02:58 -0400 Subject: [PATCH] ChannelMessageList and UserMessageList: scroll to bottom onFirstAppear --- Meshtastic/Views/Messages/ChannelMessageList.swift | 3 +++ Meshtastic/Views/Messages/UserMessageList.swift | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index 5102099f..1c1a1921 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -130,6 +130,9 @@ struct ChannelMessageList: View { .defaultScrollAnchorTopAlignment() .defaultScrollAnchorBottomSizeChanges() .scrollDismissesKeyboard(.immediately) + .onFirstAppear { + debouncedScrollToBottom(scrollView: scrollView, lastMessageId: lastMessageId, delay: 0.1) + } .onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification)) { _ in // Keyboard is about to appear: keyboard show animation hasn't quite started yet. // Schedule an immediate scroll to the bottom message by its messageId, in order to force LazyVStack to render that cell if it isn't rendered already diff --git a/Meshtastic/Views/Messages/UserMessageList.swift b/Meshtastic/Views/Messages/UserMessageList.swift index 4e9c6881..09766c32 100644 --- a/Meshtastic/Views/Messages/UserMessageList.swift +++ b/Meshtastic/Views/Messages/UserMessageList.swift @@ -128,6 +128,9 @@ struct UserMessageList: View { .defaultScrollAnchorTopAlignment() .defaultScrollAnchorBottomSizeChanges() .scrollDismissesKeyboard(.immediately) + .onFirstAppear { + debouncedScrollToBottom(scrollView: scrollView, lastMessageId: lastMessageId, delay: 0.1) + } .onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification)) { _ in // Keyboard is about to appear: keyboard show animation hasn't quite started yet. // Schedule an immediate scroll to the bottom message by its messageId, in order to force LazyVStack to render that cell if it isn't rendered already