nuclearpasta / react-native-drax

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

Static Axis #68

Closed afgarcia86 closed 3 years ago

afgarcia86 commented 4 years ago

I don't really love this change but it would help with #65

lafiosca commented 3 years ago

I somehow never saw this until now!! I am not sure when I'll be able to review.

lafiosca commented 3 years ago

This solution seems to work on the entire provider, but I think it really needs to be made granular to the DraxList (and potentially DraxViews). I'm imagining a new DraxList prop named lockDragAxis which causes the list items to only be draggable within the orientation axis of the list. And perhaps DraxView props named lockDragXAxis and lockDragYAxis, which the DraxList can use to implement that. I think the DraxView can probably use these props cosmetically rather than modifying the values in the provider's drag handling; it will just modify the hover transform styling to ignore one or the other value. I will work up a separate PR.