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