Use animation on remove swipe action

This commit is contained in:
Jackson Harper
2024-01-11 11:48:13 +08:00
parent 9feb6bb0e5
commit 1e8ac68a38

View File

@ -884,7 +884,9 @@ struct AnimatingCellHeight: AnimatableModifier {
case .delete: case .delete:
return AnyView(Button( return AnyView(Button(
action: { action: {
viewModel.removeLibraryItem(dataService: dataService, objectID: item.objectID) withAnimation(.linear(duration: 0.4)) {
viewModel.removeLibraryItem(dataService: dataService, objectID: item.objectID)
}
}, },
label: { label: {
Label("Remove", systemImage: "trash") Label("Remove", systemImage: "trash")
@ -893,7 +895,9 @@ struct AnimatingCellHeight: AnimatableModifier {
case .moveToInbox: case .moveToInbox:
return AnyView(Button( return AnyView(Button(
action: { action: {
viewModel.moveToFolder(dataService: dataService, item: item, folder: "inbox") withAnimation(.linear(duration: 0.4)) {
viewModel.moveToFolder(dataService: dataService, item: item, folder: "inbox")
}
}, },
label: { label: {
Label(title: { Text("Move to Library") }, Label(title: { Text("Move to Library") },