I just want to stop the animation when I have a multi List in multi-level NavigationView. Maybe this is not "ANIMATION", I just want to fix that.
On Xcode Version 11.3.1 (11C504) + iOS 13.2
The code is simple and you can find out it's wired.
import SwiftUI
struct TestView: View {
var body: some View {
NavigationView {
List {
ForEach(1...4, id: \.self) {_ in
NavigationLink(destination: AView()) {
Text("root")
}
}
}
}
}
}
struct AView: View {
var body: some View {
List {
ForEach(1...4, id: \.self) {_ in
NavigationLink(destination: BView()) {
Text("aview")
}
}
}
}
}
struct BView: View {
var body: some View {
List {
ForEach(1...4, id: \.self) {_ in
NavigationLink(destination: BView()) {
Text("bview")
}
}
}
}
}
struct TestView_Previews: PreviewProvider {
static var previews: some View {
TestView()
}
}
Ok... I've installed this bad-luck Xcode 11.3.1... and here is a solution (or workaround, anyway) - use explicit .listRowInsets
as in below example (btw, insets can be any value)
List {
ForEach(1...1000, id: \.self) {_ in
NavigationLink(destination: BView()) {
Text("bview")
}
}
.listRowInsets(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20))
}
Works for any dynamic List