SortableJS / react-sortablejs

React bindings for SortableJS
http://sortablejs.github.io/react-sortablejs/
MIT License
2.07k stars 211 forks source link

direction="horizontal" not work as expected #285

Open aminsoraya opened 1 year ago

aminsoraya commented 1 year ago

After I mentioned :


 <ReactSortable list={state} setList={setState} direction="horizontal">
      {state.map((item) => (
        <div key={item.id}>{item.name}</div>
      ))}
    </ReactSortable>

It doesn't aligned as expected why?

R3D347HR4Y commented 1 year ago

Same problem here, direction horizontal does not do anything

ADTC commented 1 month ago

Such a strange choice of implementation. It is a naming problem. It looks like: horizontal means vertical, and vertical means horizontal.

I literally wrote this in my code, because vertical wouldn't do it:

  direction='horizontal' // not sure why, but horizontal means drag up and down

Note that this doesn't change how your list items are visually laid out on page. It only controls the direction the sortable is expected to work in. You should still use CSS to lay out the elements in a way that matches the expectation, such as using flex-direction, flex-wrap, etc.