tajo / react-movable

🔀 Drag and drop for your React lists and tables. Accessible. Tiny.
https://react-movable.pages.dev
MIT License
1.53k stars 51 forks source link

Expose needle position and currently dragging index #86

Closed ben-styling closed 2 months ago

ben-styling commented 2 years ago

Hi here,

Firstly thank you for this library!

This PR includes 2 changes.

  1. itemDragged is exposed to the renderItem function
  2. needle is exposed to the renderList function as a getter prop getNeedle

This change allows for some more flexible styling based on the "needle" position.

tajo commented 2 years ago

Can you add an example that uses these new APIs in a realistic case?

Side note: I need to fix CI tests / move them over to Github actions.

ben-styling commented 2 years ago

Can you add an example that uses these new APIs in a realistic case?

Sorry for the delayed response. I've added an example for InsertNeedle.

The actual styling of this is a bit of a hack as I intended to make minimal changes to the library while still being able to style like this.

tajo commented 2 months ago

If you want to rebase/fix this, this would be a still good feature to have I think. Feel free to reopen if still interested.