出于某种原因,我的 NavigationLink 似乎只能在长按时工作。这是视图的片段:
struct MainView: View {
@EnvironmentObject var user: UserObservable
var body: some View {
VStack {
NavigationView {
List(user.items, id: \.self) { item in
NavigationLink(destination: ItemView(item: item)) {
Text(item.name)
}
}
.navigationBarTitle("\(user.displayName)'s items")
.navigationBarItems(leading: AddItemViewButton().environmentObject(user),
trailing: MainViewActionSheet().environmentObject(user))
}
}
}
}
该列表已正确填充,但点击它们没有任何作用。按住然后松开确实会打开正确的目的地。
有没有其他人见过这样的事情?这是在 Xcode 11.4.1 和 iOS 13.4.1 上。