minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.
MIT License
516 stars 69 forks source link

Is it possible to provide a prop to control a scroll while dragging? #184

Closed aslanalyiev closed 1 year ago

aslanalyiev commented 1 year ago

Is your feature request related to a problem? Please describe. For example, if I have 100+ items inside a container but am able to see only the first 20(for example) I must reach the bottom of the last item while dragging to make the scroll work

Describe the solution you'd like I want that scroll would de configurable and would not depend on the root component. For example, if I'm starting to drag an item from the center(visible center) a tree should understand that it should be scrolled up or bottom. Instead of waiting until I reach the border of the top or bottom of the root component. The root element bounds may not always be visible and this creates problems :(

minop1205 commented 1 year ago

@aslanalyiev Would the following examples be helpful? (Open Folder1 and try it.)

https://codesandbox.io/s/scroll-control-413jp0?file=/src/App.tsx

aslanalyiev commented 1 year ago

Hey, thank you a lot

clarkzsd commented 3 weeks ago

@aslanalyiev Would the following examples be helpful? (Open Folder1 and try it.)

https://codesandbox.io/s/scroll-control-413jp0?file=/src/App.tsx

@minop1205 hi, It looks like this link is no longer valid. Can you please provide a new link for demo that is available?

minop1205 commented 3 weeks ago

@clarkzsd Sorry, I deleted the old link to the sandbox.

I have created a new similar sandbox, please refer to this one.

https://codesandbox.io/p/sandbox/scroll-control-ts-4s4pq4

In this sandbox src/Treeview.tsx will be helpful.