commit 826fd1ef33feb6486025647600b94819cb1a124e
parent 54dd2035a1311f83cb5b0c43581e7b970b6cea20
Author: William Casarin <jb55@jb55.com>
Date: Mon, 20 Feb 2023 14:26:45 -0800
More consistent scrolling to top behavior
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/damus/Views/TimelineView.swift b/damus/Views/TimelineView.swift
@@ -42,6 +42,10 @@ struct TimelineView: View {
var MainContent: some View {
ScrollViewReader { scroller in
ScrollView {
+ Color.white.opacity(0)
+ .id("startblock")
+ .frame(height: 1)
+
InnerTimelineView(events: events, damus: damus, show_friend_icon: show_friend_icon, filter: loading ? { _ in true } : filter)
.redacted(reason: loading ? .placeholder : [])
.shimmer(loading)
@@ -56,13 +60,9 @@ struct TimelineView: View {
.buttonStyle(BorderlessButtonStyle())
.coordinateSpace(name: "scroll")
.onReceive(NotificationCenter.default.publisher(for: .scroll_to_top)) { _ in
- let delay = events.has_incoming ? 0.1 : 0.0
events.flush()
- guard let event = events.events.filter(self.filter).first else {
- return
- }
self.events.should_queue = false
- scroll_to_event(scroller: scroller, id: event.id, delay: delay, animate: true, anchor: .top)
+ scroll_to_event(scroller: scroller, id: "startblock", delay: 0.0, animate: true, anchor: .top)
}
}
.onAppear {