Row should get dragged to its destination index when dragged from top to bottom and vice versa with DnD animation.
Row doesn’t get DnD when dragged from bottom to top index. Top to bottom drag works but the item is added after the last page index and not to the destination index. DnD animation seems not to be working as well.
You can refer this sandbox to replicate the issue.
Case 1: Top to bottom drag
Case 2. Bottom to Top drag
The same code works with react-virtualized's List component but not the Table component.
React
are you using?16.13.0
react-beautiful-dnd
are you running?13.0.0
react-virtualized
are you running?9.22.3
Chrome
I have created this sandbox to replicate the issue. You can run this to check the issue.
https://codesandbox.io/s/vertical-list-forked-3lp71?file=/index.js
Can anyone take a look at the sandbox and help me out? Let me know if you need another info!
So today, I debug this more and made some progress. Looks like the issue was with rowRenderer implementation. There was an extra wrapper div on top of defaultRowRenderer's dom. I was able to solve the issue partially. Here is the new sandbox link with the updated code.
Now, there's one issue left is scroll doesn't work while dragging the row. Any pointers how can I fix this?
Finally, solved the issue (not sure if this is the right way). The solution was to pass ref as react virtualized scrolling wrapper div instead of react-virtualized main wrapper div.
I had updated the above sandbox with the fix.
Before
ref={(ref) => {
if (ref) {
// eslint-disable-next-line react/no-find-dom-node
const whatHasMyLifeComeTo = ReactDOM.findDOMNode(ref);
if (whatHasMyLifeComeTo instanceof HTMLElement) {
provided.innerRef(whatHasMyLifeComeTo);
}
}
}}
After (fix)
ref={(ref) => {
if (ref) {
const whatHasMyLifeComeTo = document.getElementsByClassName(
"ReactVirtualized__Grid ReactVirtualized__Table__Grid"
)[0];
if (whatHasMyLifeComeTo instanceof HTMLElement) {
provided.innerRef(whatHasMyLifeComeTo);
}
}
}}