react-native-draggable-flatlist
react-native-draggable-flatlist copied to clipboard
How can I get nested DraggableFlatList to work?
I have an array of objects where each object also contains an array of items.
For example: [ { group1: [{...}] }, { group2: [{...}] }, { group3: [{...}] } ]
I need to be able to sort the groups and also items in the groups. The component works fine when sorting the groups but when I try to drag items, I get this error this._scrollRef.scrollTo is not a function
.
My code is something like this:
<DraggableFlatList data={mainArray} renderItem={() => ( {... <DraggableFlatList data={itemArray} ... /> } )} />
@wonghupwen Did you get any solution then?
You can make it work by putting the DraggableFlatList
into a separate class... see this snack (this also makes the inner lists collapsible)
https://snack.expo.io/@bonehead06/sortable-collapsible-nested-list
@bonehead06 the scroll is not working
Adjust activationDistance param
You can use the scrollEnabled field from your parent DraggableFlatList.
To disable scrolling of parent DraggableFlatList while dragging in child DraggableFlatLis
Any update on this one? Really want to have an example of the author's above requirement