Fixed scroll to top

This commit is contained in:
Thomas Ricouard 2022-12-31 15:41:44 +01:00
parent 224b1b0693
commit a06386c1da

View File

@ -34,10 +34,10 @@ public struct TimelineView: View {
ScrollViewReader { proxy in ScrollViewReader { proxy in
ZStack(alignment: .top) { ZStack(alignment: .top) {
ScrollView { ScrollView {
Rectangle()
.frame(height: 0)
.id(Constants.scrollToTop)
LazyVStack { LazyVStack {
Rectangle()
.frame(height: 0)
.id(Constants.scrollToTop)
tagHeaderView tagHeaderView
.padding(.bottom, 16) .padding(.bottom, 16)
StatusesListView(fetcher: viewModel) StatusesListView(fetcher: viewModel)
@ -93,8 +93,8 @@ public struct TimelineView: View {
private func makePendingNewPostsView(proxy: ScrollViewProxy) -> some View { private func makePendingNewPostsView(proxy: ScrollViewProxy) -> some View {
if !viewModel.pendingStatuses.isEmpty { if !viewModel.pendingStatuses.isEmpty {
Button { Button {
proxy.scrollTo(Constants.scrollToTop)
withAnimation { withAnimation {
proxy.scrollTo(Constants.scrollToTop)
viewModel.displayPendingStatuses() viewModel.displayPendingStatuses()
} }
} label: { } label: {