Comments (4)
Hi @oyeanuj , thanks for the feedback.
- Unfortunately Grid layout is not supported, maybe in future releases.
- I think you can make it like this: Put Container inside Draggable and set a margin, so that each item will contain Container component. If the dragged element is inside the inner Container it will be dropped in it. If it is over the margin area parent Draggable will slide. And If you also don't want the inner Containers accept more than one draggable, set the shouldAcceptDrop function. Hope it's clear and it works :)
from react-smooth-dnd.
@kutlugsahin Thank you for the quick response! Two quick follow-ups:
-
Do you expect it to work with a Flexbox list spread in two rows/columns?
-
This is an interesting idea! So, essentially, you're suggesting that I look at the
element
with theonDrop
handler and see if it is the child or the parent and then base it on that?
from react-smooth-dnd.
@oyeanuj
Np!
- No It won't work in wrapped Flexbox having both rows and columns. Layout calculations are done in only one axis depending if the container is horizontal or vertical.
- No you don't need to look at the element and do something according to it. Probably it wont work.
Let me illustrate the code. Lets say You have a container with three items and as far as I understand you are trying to drop new item from outside. So your target Container would be like this
<Container>
<Draggable>
<div style={{ margin: '30px' }}>
<Container shouldAcceptDrop={...}></Container>
</div>
</Draggable>
<Draggable>
<div style={{ margin: '30px' }}>
<Container></Container>
</div>
</Draggable>
<Draggable>
<div style={{ margin: '30px' }}>
<Container></Container>
</div>
</Draggable>
</Container>
from react-smooth-dnd.
@kutlugsahin Oh, I see. So nest the containers? Cool, I'll give it a shot and get back to you if I have more questions!
Thanks for the help!
from react-smooth-dnd.
Related Issues (20)
- Native touch scroll is blocked after touch/scroll on the react-smooth-dnd HOT 1
- Does it support html tables? HOT 2
- shouldAcceptDrop not detecting that element is dragged over HOT 10
- Is the license correct at MIT?
- Draggable render ref HOT 1
- Documentation for functional components? HOT 1
- Cannot read property 'setDraggables' of undefined HOT 4
- Why I click the dragabled Item will trigger drag event?
- Container control on dynamic fields HOT 1
- onDrop returning invalid addedIndex and removedIndex HOT 1
- Property 'children' does not exist on type 'IntrinsicAttributes....' HOT 10
- Functional components
- horizontal scroll not working when using infinite scroll HOT 3
- Flickering issue HOT 2
- Question about getContainerOptions
- Please fix "Property 'children' does not exist on type 'IntrinsicAttributes'"
- Performance issue
- How to use payload on onDragEnd Or return dragged element
- 为什么我写的onDrop方法的 addedIndex不是正确的数组的index,像是随机的一样
- Uncaught TypeError: Cannot read properties of undefined (reading 'setDraggables')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-smooth-dnd.