react-native-draggable-flatlist icon indicating copy to clipboard operation
react-native-draggable-flatlist copied to clipboard

How can I get nested DraggableFlatList to work?

Open wonghupwen opened this issue 5 years ago • 6 comments

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 avatar Sep 19 '19 10:09 wonghupwen

@wonghupwen Did you get any solution then?

ReemaVinodGangdev avatar Feb 20 '20 12:02 ReemaVinodGangdev

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 avatar Oct 22 '20 01:10 bonehead06

@bonehead06 the scroll is not working

ZeeshanAhmadKhalil avatar May 26 '21 08:05 ZeeshanAhmadKhalil

Adjust activationDistance param

cyber1443 avatar Jul 30 '21 00:07 cyber1443

You can use the scrollEnabled field from your parent DraggableFlatList.

To disable scrolling of parent DraggableFlatList while dragging in child DraggableFlatLis

ReSenpai avatar Jul 22 '22 11:07 ReSenpai

Any update on this one? Really want to have an example of the author's above requirement

trungledangAxonActive avatar Oct 25 '23 02:10 trungledangAxonActive