ValentinH / react-easy-sort

A React component to sort items in lists or grids
https://ValentinH.github.io/react-easy-sort
MIT License
160 stars 25 forks source link

Confine drag to an axis #27

Closed dennis-best closed 2 years ago

dennis-best commented 2 years ago

As a developer, I'm using this to re-order items in a simple vertical list. So it's potentially jarring or confusing when a user is dragging an element and it can be dragged literally anywhere on the screen.

Ideally, there'd be a prop like dragDirection (any, y-only, x-only)?

Here's a shot of my component vs iOS list re-ordering.

Screen Shot 2022-01-21 at 11 26 43 AM

aaaimage

ValentinH commented 2 years ago

Yes this would be a nice feature, I like it. Would you like to do a PR for it?

ValentinH commented 2 years ago

Starting from v1.4.0, there is a lockAxis option.