react-native-draggable-flatlist
react-native-draggable-flatlist copied to clipboard
is it possible to drag items between two different flatlist?
i would like to have two draggable flatlist and be able to drag items between them... i couldn't achieve this... anyone has any idea on how to achieve this?
actually, what I need is to add a separator between items, like a section separator. I wasnt able to do this with one flatlist, that is why I believe that the best way to achieve this is to have two flatlists and drag items between them.
thanks everyone

you could do this with one flatlist -- you may have to modify your data a bit, something like:
const data = [
{ type: 'item', data: 'a' },
{ type: 'item', data: 'b' },
{ type: 'separator', title: 'SEPARATOR' },
{ type: 'item', data: 'c'}
]
and then you'll have a switch or equivalent in your renderItem
@computerjazz we are looking for something similar too but we don't want "Separator" to be draggable. Using a single flatlist will make all the items(including separator) draggable right?
it's up to you to decide when something is draggable by calling drag()
in renderItem
. So if your separator does not call drag()
, it will not be draggable.
I am creating a trello clone. And there we can drag and drop lists, drag and drop cards in a list (both of them are too easy to be implmented, thanks to this library ) but how can i drag and drop a card from one list to another. Here i cannot have a single flatlist as the list one is horisontal and the card one is vertical
how will this work with an accordion?
const data = [
{ type: 'item', data: 'a' },
{ type: 'item', data: 'b' },
{ type: 'separator', title: 'SEPARATOR' },
{ type: 'item', data: 'c'}
]