clauderic / clauderic/react-sortable-hoc

Downward item get weird animation behavior

Open
#747 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

Hi! I'm using react-sortable-hoc with [antd table](https://ant.design/components/table/#components-table-demo-drag-sorting-handler),
I need sortable limit more clear for user, so I customize some border like this 👇

Screen Shot 2020-10-08 at 8 44 12 PM

A few later I found a weird animation behavior when downward item,
I think maybe it cause by didn't create `DraggableContainer` inside `render`,
but I can't create `DraggableContainer` inside `render`,
beacuse rerender `DraggableContainer` will unmount itself,
that will cause `onSortStart` and `onSortEnd` setState throw lifecycle error... ❌

![weird behavior](https://user-images.githubusercontent.com/9082423/95464288-53ce8380-09ac-11eb-860b-e9633ab5b758.gif)

I also check dev tool downward item y axis pixel is correct,
is it necessary create `DraggableContainer` inside `render` ?

![out](https://user-images.githubusercontent.com/9082423/95466823-54b4e480-09af-11eb-8fb0-46ebc51a68cd.gif)

### ⭐️ My workaround
Add `transition: none !important` to ignore animate when drag end.
```css
.ignoreSortingAnimation :global .ant-table-tbody tr {
transition: none !important;
}
```

- ### customize with collection border
⚠️ workaround has been comment
[![Play ground](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/sweet-yonath-mii86?file=/src/SortableTable.js)
- ### render `DraggableContainer` inside `render`
downward item weird animation gone, but can't setState in `onSortStart` and `onSortEnd`
[![Play ground](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/inspiring-stallman-xpsfi?file=/src/SortableTable.js)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.