summaryrefslogtreecommitdiff
path: root/Sora/Views/Post/Grid
diff options
context:
space:
mode:
Diffstat (limited to 'Sora/Views/Post/Grid')
-rw-r--r--Sora/Views/Post/Grid/PostGridView.swift13
1 files changed, 10 insertions, 3 deletions
diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift
index cc3a3cd..78d90b3 100644
--- a/Sora/Views/Post/Grid/PostGridView.swift
+++ b/Sora/Views/Post/Grid/PostGridView.swift
@@ -16,7 +16,7 @@ struct PostGridView: View {
}
var body: some View {
- ScrollViewReader { _ in
+ ScrollViewReader { proxy in
ScrollView {
if filteredPosts.isEmpty {
ProgressView()
@@ -25,6 +25,7 @@ struct PostGridView: View {
WaterfallGrid(filteredPosts, id: \.id) { post in
waterfallGridContent(post: post)
+ .id(post.id)
}
.gridStyle(columns: settings.thumbnailGridColumns)
.padding(8)
@@ -89,14 +90,20 @@ struct PostGridView: View {
}
PlatformSpecificToolbarItem {
- Button(action: { manager.goBackInHistory() }) {
+ Button(action: {
+ manager.goBackInHistory()
+ withAnimation { proxy.scrollTo(filteredPosts.first?.id) }
+ }) {
Label("Previous Search", systemImage: "chevron.left")
}
.disabled(!manager.canGoBackInHistory)
}
PlatformSpecificToolbarItem {
- Button(action: { manager.goForwardInHistory() }) {
+ Button(action: {
+ manager.goForwardInHistory()
+ withAnimation { proxy.scrollTo(filteredPosts.first?.id) }
+ }) {
Label("Next Search", systemImage: "chevron.right")
}
.disabled(!manager.canGoForwardInHistory)