apptekstudios / ASCollectionView

A SwiftUI collection view with support for custom layouts, preloading, and more.
MIT License
1.36k stars 160 forks source link

A bit sticky Drag & sort #228

Open skywalkerlw opened 3 years ago

skywalkerlw commented 3 years ago

See the video (i have a list of 30 items), the problem is on around 2nd second

https://user-images.githubusercontent.com/2090084/138644966-15ccb984-9e95-4207-b337-3e0e41b76a23.mp4

My code

VStack {
            InlineNotification(message: "Drag & drop to reorder items", style: .warning)
            ASTableView
            {
                ASSection<Int>(
                    id: 0,
                    data: sortedList,
                    dataID: \.self,
                    dragDropConfig: ASDragDropConfig(onMoveItem: { from, to in
                        move(from, to)
                    })
//                    onSwipeToDelete: { index, _ -> Bool in
//                        withAnimation
//                        {
//                            _ = self.sortedList.remove(at: index)
//                        }
//                        return true
//                    }
                )
                { item, _ in
                    GoodsListItemSimple(imageUrl: item.goodsImg, name: item.goodsName)
                        .padding(12)
                }
            }
            .onReachedBottom {
            }
        }