Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nesting and ownership of React DnD backends #264

Closed
jaygood opened this issue Aug 17, 2015 · 7 comments
Closed

Nesting and ownership of React DnD backends #264

jaygood opened this issue Aug 17, 2015 · 7 comments

Comments

@jaygood
Copy link

jaygood commented Aug 17, 2015

Is there a handle to already established backends/DragDropContext? I'm using your code from #186:

let defaultManager;
function getDefaultManager() {
    if (!defaultManager) {
        defaultManager = new DragDropManager(HTML5Backend);
    }
    return defaultManager;
}

But is there a way to check if another application has created a manager?

@gaearon
Copy link
Member

gaearon commented Sep 17, 2015

Nesting backends is not thought out well now. If you'd like to propose an API change to make it more explicit I'm happy to hear it!

@gaearon gaearon changed the title HTML5 backends Nesting and ownership of React DnD backends Sep 17, 2015
@jpollard-cs
Copy link

I'm using a modified version of DragDropContext which simply uses the above getDefaultManager where the childContext is declared like so:

    const childContext = {
        dragDropManager: getDefaultManager(backend)
    };

this is working beautifully for me with a nested drag & drop card layout, but I admittedly haven't taken the time to review all the implications of this approach yet

@akhayoon
Copy link

@gaearon

Whenever I try to do this I keep getting

DragDropManager.js:40 Uncaught TypeError: createBackend is not a function

Any idea what could be causing this? I have the exact same code as @jaygood with DragDropManager imported from dnd-core and HTML5Backend imported from the correct library.

@bureson
Copy link

bureson commented Aug 8, 2018

@akhayoon @gaearon After updating React DND (and also React HTML5 Backend) from 2.6 to 5.0, I'm getting this error as well.

@JJie09
Copy link

JJie09 commented Sep 4, 2018

@bureson hello, im facing this issue as well, any workaround?

@bureson
Copy link

bureson commented Oct 8, 2018

@JJie09 you will need to change the way how you import the lib, one of following:

import HTML5Backend from "react-dnd-html5-backend"
const HTML5Backend = require('react-dnd-html5-backend').default;

@stale
Copy link

stale bot commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 6, 2019
@stale stale bot closed this as completed Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants