I have the same problem, please let us know if some of you have the answer or solution, cheers
Post
Replies
Boosts
Views
Activity
In my case, LazyVStack helped to fix the scrollTo issue
struct ContentView: View {
var body: some View {
ScrollViewReader { proxy in
ScrollView {
VStack {
Color.yellow
.frame(height: 800)
ScrollButton(proxy: proxy)
}
}
}
}
}
struct ScrollButton: View {
let proxy: ScrollViewProxy
@Namespace var bottomId
var body: some View {
LazyVStack {
Button("Scroll") {
withAnimation {
proxy.scrollTo(bottomId)
}
}
Color.red
.frame(height: 500)
.id(bottomId)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}