nuclearpasta / react-native-drax

A drag-and-drop system for React Native
MIT License
554 stars 69 forks source link

Change zIndex of Hover Item #135

Closed v-octal closed 2 years ago

v-octal commented 2 years ago

Is it possible to make sure the component being dragged always stays on top of other content? I tried setting zIndex in renderItemHoverContent, and itemStyles. But, nothing really happened. It just does the normal behaviour of being on top of content above the DraxList and being below on content below the DraxList.

This library saved my life. Really appreciate your work!

lafiosca commented 2 years ago

At least on iOS, zIndex can only do so much. I think it's generally only applied with regard to siblings of the same parent element. If I recall correctly, the hover views are children of the DraxProvider and should render on top of anything that is nested underneath that. Is that not the behavior you are seeing? Or is it possible you have other elements that are outside of the DraxProvider element hierarchy? Could you share an example of the bad behavior?

v-octal commented 2 years ago

@lafiosca Yes, I had other elements which were outside DraxProvider element hierarchy. I had a small draggable component among other things. After reading your comment, I tried wrapping the entire screen with DraxProvider and it worked. So, it solves my purpose. Thank you 🙏🏾

Let me know if you would still like to see an example, I would be happy to create a sample snippet. Or We can close this ticket as well.

lafiosca commented 2 years ago

Sounds like it's working as intended, so no need for a snippet :) Thanks!

rampazzo1989 commented 1 year ago

Is there a way to make a view that is inside the same DraxProvider of a dragged view be on top of it? I mean, a view be on top of the dragged hover copy. And they're on the same provider.

lafiosca commented 1 year ago

Been quite a while since I have messed with the library, but I would guess that would be pretty difficult to do because of the way it's implemented. The hover view is the final child of the Provider, if I recall correctly.