Closed Rc85 closed 6 months ago
Are you talking about the flatlist example? The useDraggableGrid hook contains an onOrderChanged
callback that responds with the new list ordering when you drop the object in it's new position.
@jtc3161 Do know where the documentation might be for useDraggableGrid? I noticed several things exist (DraggableFlatList and several hooks) without documentation.
I've been trying implement something similar to the "Demo" here but I don't see how the Demo is possible with the documented functionality. Specifically, making space where the droppable item will go and then handling the new order once it's dropped. Regarding the question here, I assume @Rc85 also wants the same thing.
I've re-written the draggable grid from the ground up and I'm currently improving the docs.
There is now two easy-to-use components DraggableStack
and DraggableGrid
.
The draggable stack can only sort on a single axis but handles variable width. Probably what you want. I also have a DraggableFlatList
in the works but there is still some issues when trying to sort out of bounds in specific situations.
I have added updated examples here: https://github.com/mgcrea/react-native-dnd/tree/master/example/src/pages
Let me know if there is anything unclear.
Like this?