Post

Replies

Boosts

Views

Activity

Reply to List Items Shift When Tapping on NavigationLink
I was running into this issue as well, and was able to resolve it by including a binding for the List's selection argument. I'm not quite sure why this fixed it, but worked for my needs. I was able to verify this in the code sample you provided above as well. Hope this works for you! import SwiftUI struct ContentView: View { let items = generateItems() @State var selectedItem: String? var body: some View { NavigationStack { List(items, id: \.self, selection: $selectedItem, rowContent: { item in NavigationLink { Text(item) } label: { Text(item) } }) .navigationTitle("Items") } } } #Preview { ContentView() } func generateItems() -> [String] { var items: [String] = [] for i in 1...1000 { items.append("\(i)") } return items }
Apr ’24