React-sortable-hoc: Flex & CSS Styling on Drag & Drop

Created on 4 Jan 2019  ·  3Comments  ·  Source: clauderic/react-sortable-hoc

Hey,

I seem to be having an issue where i have a container that is being dragged loses it's flex property.

This is a basic example of the setup. All the items in "playlist-items" unflex when the "row" is being sorted.

.row {
   width: 100%;
}

.playlist-items {
    width: 100%;
    display: flex;
}

<div className="row">
    <h2>My playlist</h2>
    <div className="playlist-items>
         <img>
         <img>
         <img>
         <img>
         <img>
         <img>
    </div>
</div>

Most helpful comment

可能是因为样式嵌套?
库会把原来的ele隐藏,在Body上挂载一个临时的ele。
而这个临时的ele,因为脱离了原先的css嵌套结构,丢失了样式

All 3 comments

I should also mention that if i make it <div className="playlist-items" style="display: flex"> then it corrects this.

However styling for the h2 is also lost on drag and drop. Whats happening under the hood to do this?

Closing this unless you can provide a CodeSandbox reproducing the issue for me to look at. You can also try asking on StackOverflow, as Github is mostly intended for reporting issues with a library.

可能是因为样式嵌套?
库会把原来的ele隐藏,在Body上挂载一个临时的ele。
而这个临时的ele,因为脱离了原先的css嵌套结构,丢失了样式

Was this page helpful?
0 / 5 - 0 ratings