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

Is there any droppable component?

Open nitingupta220 opened this issue 5 years ago • 11 comments

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.

nitingupta220 avatar Feb 17 '20 06:02 nitingupta220

@baconcheese113 ??

nitingupta220 avatar Feb 17 '20 08:02 nitingupta220

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

baconcheese113 avatar Feb 17 '20 20:02 baconcheese113

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?

nitingupta220 avatar Feb 18 '20 05:02 nitingupta220

Can you reproduce your issue in a snack

baconcheese113 avatar Feb 18 '20 06:02 baconcheese113

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

nitingupta220 avatar Feb 18 '20 09:02 nitingupta220

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?

baconcheese113 avatar Feb 18 '20 17:02 baconcheese113

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

nitingupta220 avatar Feb 19 '20 08:02 nitingupta220

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.

baconcheese113 avatar Feb 20 '20 20:02 baconcheese113

Hey, can you make a little snack for this? Will be helpful.

nitingupta220 avatar Feb 21 '20 06:02 nitingupta220

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.

baconcheese113 avatar Feb 21 '20 07:02 baconcheese113

@nitingupta220 did you get any solution?

tarmoire avatar Aug 12 '22 09:08 tarmoire