Skip to content

Commit

Permalink
- Fix issue where ScrollToView onDisappear doesn't get called.
Browse files Browse the repository at this point in the history
  • Loading branch information
boscojwho committed Oct 7, 2023
1 parent c41cd08 commit e339faa
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions Mlem/Views/Shared/ScrollToView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ struct ScrollToView: View {
@Binding var appeared: Bool

var body: some View {
HStack(spacing: 0) {
EmptyView()
}
.frame(height: 1)
.onAppear {
appeared = true
}
.onDisappear {
appeared = false
/// We don't have any horizontal scroll views yet, but this may need to be a LazyHStack if we do. [2023.09]
LazyVStack(spacing: 0) {
HStack(spacing: 0) {
EmptyView()
}
.frame(height: 1)
.onAppear {
appeared = true
}
.onDisappear {
appeared = false
}
}
}
}
Expand All @@ -38,13 +41,16 @@ struct ListScrollToView: View {
@Binding var appeared: Bool

var body: some View {
EmptyView()
.frame(height: 1)
.onAppear {
appeared = true
}
.onDisappear {
appeared = false
}
/// We don't have any horizontal scroll views yet, but this may need to be a LazyHStack if we do. [2023.09]
LazyVStack(spacing: 0) {
EmptyView()
.frame(height: 1)
.onAppear {
appeared = true
}
.onDisappear {
appeared = false
}
}
}
}

0 comments on commit e339faa

Please sign in to comment.