Hi,
Anyone encountered this?
I bring up a modal sheet using my add button. Then I dismiss it by swiping down. Immediately after that, the button is unresponsive and I cannot bring up the modal sheet again.
However, if I scroll the list, the button is functional again. I can include a video of what I see if you like.
Snippet of my code below.
struct TaskToDoView: View {
@Environment(\.managedObjectContext) private var viewContext
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \SimpleRecord.title, ascending: true)],
animation: .default)
private var items: FetchedResults<SimpleRecord>
@State private var isModal = false
var body: some View {
NavigationView {
List {
ForEach(items) { item in
NavigationLink(destination: ToDoModelView()) {
Text("Item at \(item.title!)")
}
}
.onDelete(perform: deleteItems)
}
.toolbar {
HStack {
#if os(iOS)
EditButton()
#endif
Button(action: addItem) {
Label("Add Item", systemImage: "plus")
}
.sheet(isPresented: $isModal,
onDismiss: dismissToDoModelView,
content: {
ToDoModelView()
})
}
}
}
}
private func dismissToDoModelView() {
print("Modal Dismissed")
print("Modal is \(self.isModal)")
}
private func addItem() {
self.isModal.toggle()
}
....
}