StephenChou1017 / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers (IE10+)
https://stephenchou1017.github.io/scheduler/#/
MIT License
754 stars 414 forks source link

Could not find the drag and drop manager in the context of ResourceEvents. #215

Open alexbran8 opened 4 years ago

alexbran8 commented 4 years ago

Hi guys,

Could you please help me fix this error?

this is my component:

          <Scheduler
            schedulerData={viewModel}
            prevClick={this.prevClick}
            nextClick={this.nextClick}
            onSelectDate={this.onSelectDate}
            onViewChange={this.onViewChange}
          />

this is how I export it: export default withDragDropContext(Basic);

I have tried to wrap schedule in:

<DndProvider backend={HTML5Backend}>
          <Scheduler
            schedulerData={viewModel}
            prevClick={this.prevClick}
            nextClick={this.nextClick}
            onSelectDate={this.onSelectDate}
            onViewChange={this.onViewChange}
          />
</DndProvider>

and export it export default Basic;

then i get the error that the component is not being rendered properly:

` React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of Basic. in Basic (created by Context.Consumer)`

I am using the latest packages: "react-big-scheduler": "^0.2.7", "react-dnd": "^7.5.0", "react-dnd-html5-backend": "^7.5.0",

Thanks!

babiryegrace20 commented 4 years ago

the versions of these packages should work for you "react-big-scheduler": "^0.2.6", "react-dnd": "^5.0.0","react-dnd-html5-backend": "^5.0.1" and also make sure you then wrap your component like this, withDragDropContext(component) while exporting it

alexbran8 commented 4 years ago

Thanks! It works! I had to remove the "reacd-dnd" and "html-backend", from packages.json, reinstalled everything and now works perfect! :)

Visualintelligence commented 3 years ago

Is anybody able to have this works with the latest version of reac-dnd? I have tried wrapping with DndProvider, DndContext, etc. but nothing seems to work.

msaladyk commented 3 years ago

Basic example worked for me with these versions:

"react-big-scheduler": "^0.2.6", "react-dnd": "^7.5.0", "react-dnd-html5-backend": "^7.5.0",

exported with withDndContext(MyScheduler)

import {DragDropContext} from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend'

export default DragDropContext(HTML5Backend);

Hector096 commented 2 years ago

It's not working, tried with every version. with react 17.0.2. need help