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

Problems with HTML5 Backend #44

Closed
romanmuska opened this issue Jan 19, 2017 · 8 comments
Closed

Problems with HTML5 Backend #44

romanmuska opened this issue Jan 19, 2017 · 8 comments

Comments

@romanmuska
Copy link

romanmuska commented Jan 19, 2017

Hi everyone,

i start using React Sortable Tree and i get error "Cannot have two HTML5 backends at the same time.".. I am using it with React DnD so i think that both components use react-dnd-html5-backend so there is a problem. Does someone know how to solve it? Thanks.

@fritz-c
Copy link
Member

fritz-c commented Jan 21, 2017

Hi, thanks for trying out the component. Try using the react-dnd context you're already using along with the context-less exported component SortableTreeWithoutDndContext

Something like:

import { SortableTreeWithoutDndContext } from 'react-sortable-tree';
import { dragDropContext } from 'react-dnd';

// ...

const myReactDndContext   = dragDropContext(HTML5Backend);
const SortableTree        = myReactDndContext(SortableTreeWithoutDndContext);
const MyOtherDndComponent = myReactDndContext(OtherComponent);

// ... use them in render()

@fritz-c
Copy link
Member

fritz-c commented Feb 17, 2017

Going to treat this as closed due to inactivity.

@fritz-c fritz-c closed this as completed Feb 17, 2017
@tsuz
Copy link

tsuz commented Apr 13, 2017

Thanks @fritz-c ! It worked for me using import { DragDropContext } from 'react-dnd';

@aterentev
Copy link

aterentev commented Sep 5, 2017

Hello!

I have the same problem.
I use your tree in one column and I have to use React DnD in other column.

App.js

import { DragDropContextProvider } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';

import ShowDirectoriesList from '../../containers/ShowDirectoriesList';

class App extends React.Component {
   render() {
       return (
           <DragDropContextProvider backend={HTML5Backend}>
               <Grid>
                   <Row className="show-grid">
                       <Col md={1} />
                       <Col md={5}>
                           <Panel className="explorer">
                               <ShowDirectoriesList />
                           </Panel>
                       </Col>
                       <Col md={6} />
                   </Row>
               </Grid>
           </DragDropContextProvider>
       );
   }
}

DirectoriesList.js

import SortableTreeWithoutDndContext from 'react-sortable-tree';

class DirectoriesList extends React.Component {
    render() {
        return (
            <SortableTreeWithoutDndContext
            // ...    
             />
        );
    }
}

With this code, when I tried to drag any element in the tree I got "Cannot have two HTML5 backends at the same time."

@fritz-c
Copy link
Member

fritz-c commented Sep 5, 2017

@aterentev Need to put brackets around the name in the import as follows:

import { SortableTreeWithoutDndContext } from 'react-sortable-tree';

@aterentev
Copy link

Thanks @fritz-c ! It helps.

@IvanGrodno
Copy link

IvanGrodno commented May 8, 2018

My component that uses the tree is loaded into another project by clicking on one of the tabs. The first time you load a tree, an error occurs - "Cannot have two HTML5 backends at the same time".
The decisions above did not help.

Only the change in value helps window.__isReactDndBackendSetUp = undefined or window.__isReactDndBackendSetUp = false.

The tree is loaded but the tree does not work at all drag and drop. Image
Can anyone know which fields of the 'window' object changes when working with a tree?

@wuweiweiwu
Copy link
Member

@IvanGrodno this issue is already documented as a bug / more investigation. For future reference, its probably best to open a new issue or look if this issue already exists.

Maintainers rarely check closed issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants