react-native-draggable
react-native-draggable copied to clipboard
Is there any droppable component?
Hey I just want to know that like there is a draggable component. So is there any droppable or dropzone component as well. Let me give you example: - I have my draggable component and there is a dropzone component. So I just want to drag the draggable component to the dropzone and just want the component to stay there until I drag it again?
Please help me with this.
@baconcheese113 ??
Well, this is a draggable component so it's also droppable. There's an onRelease
function that gives you the coordinates it was dropped at. You can use those to determine if it's in your dropzone
I tried to do with onRelease
but everytime I drag the component and wanted to up the coordinates of the component it always sets 10m apart from the original position. I don't know why this is happening?
Can you help?
Can you reproduce your issue in a snack
Hey @baconcheese113 I have created this snack: - Snack Link Please check this and see when you try to drag the component to the box it will drop to the exact same place. Please check and let me know what I'm doing wrong.
Thanks
Okay, I see what you're talking about. The main issue is that the initialOffsets and shouldReverse weren't designed to be modified. Is your end goal to have a component that behaves like this?
Yes, I want a component that I drag and will drop the dropzone and if someone drops it other than dropzone it just back to its original place. Can you please help me in achieving this? @baconcheese113
It's not currently supported, you can try using 2 draggable components. Have one set to shouldReverse
and the other only conditionally render if the first component is dropped in the dropzone...and pass it the x/y of the drop.
Hey, can you make a little snack for this? Will be helpful.
I wouldn't say it's trivial to implement, it's going to involve you rolling a lot of your own code. I added the enhancement label since this is a valid feature to add support for in the repo, but I'm not sure when @tongyy or I will prioritize it.
@nitingupta220 did you get any solution?