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

is it possible to drag items between two different flatlist?

Open lcastelnovo-atix opened this issue 1 year ago • 5 comments

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

Screenshot 2023-04-28 at 17 22 13

lcastelnovo-atix avatar Apr 28 '23 20:04 lcastelnovo-atix

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 avatar May 02 '23 17:05 computerjazz

@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?

adityateesta avatar May 10 '23 20:05 adityateesta

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.

computerjazz avatar May 10 '23 21:05 computerjazz

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

Irfanwani avatar May 21 '23 04:05 Irfanwani

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'} 
]

shanoysinc avatar Sep 27 '23 01:09 shanoysinc