Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the droppableActiveId as meta property in onUpdate event #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

djleven
Copy link

@djleven djleven commented Feb 24, 2024

Hello Olivier,

First of all, thank you for the wonderful contribution that is react-native-dnd.

I needed to access the active droppable Id during drag operations, ideally from the dndPovider.
The onDragEnd event provides us with this at the end of the drag process, but I could not find a way to get the id before. The reason was to manipulate some data unrelated to styling the components (which is already easily doable with useAnimatedStyle).

I struggled with a few approaches trying to get it from within my droppable component using useActiveDropReaction and useLatestValue (and even 'hacking' the useAnimatedStyle) in combination with runOnJs. But they all proved too heavy and costly. Turning to the dndPovider and exposing the id that was already there seemed the cleanest way to go.

It seems to me this could potentiality be a desired feature for many drag and drop type use cases and implementations.
Please let me know if I missed something.

Thanks,
Kostas

@djleven djleven closed this Feb 26, 2024
@mgcrea
Copy link
Owner

mgcrea commented Feb 26, 2024

Hey! Any reason you closed it? Was busy the last few days but happy to merge contributions to the project! Thanks for the PR!

@mgcrea mgcrea reopened this Feb 26, 2024
@djleven
Copy link
Author

djleven commented Mar 13, 2024

Hi Olivier!

Apologies for the late reply, I just saw this now.

I had some second thoughts about how useful this might actually be and ended up closing it.

I would be happy to look at fixing the failing tests this weekend if you still want to merge it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants