Giter Site home page Giter Site logo

Comments (4)

kutlugsahin avatar kutlugsahin commented on May 13, 2024

Hi @oyeanuj , thanks for the feedback.

  1. Unfortunately Grid layout is not supported, maybe in future releases.
  2. 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.

oyeanuj avatar oyeanuj commented on May 13, 2024

@kutlugsahin Thank you for the quick response! Two quick follow-ups:

  1. Do you expect it to work with a Flexbox list spread in two rows/columns?

  2. This is an interesting idea! So, essentially, you're suggesting that I look at the element with the onDrop handler and see if it is the child or the parent and then base it on that?

from react-smooth-dnd.

kutlugsahin avatar kutlugsahin commented on May 13, 2024

@oyeanuj
Np!

  1. 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.
  2. 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.

oyeanuj avatar oyeanuj commented on May 13, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.