question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drag and Drop : Custom props in custom component does not work

See original GitHub issue

Do you want to request a feature or report a bug?

BUG

What’s the current behavior?

  • Using <DragAndDropCalendar/> component and adding a custom toolbar in components prop
  • Passing some custom props to custom toolbar component Eg. In below sandbox passing switchView prop
  • Only initial value is passed
  • Updated value on re-render is not passed

NOTE: this behaviour is noticed in functional implementation using hooks in classical component this things works well

For bugs, please include the following if possible:

-Browser - Google Chrome -OS - MacOS -react-big-calendar - 0.26.1 -codesandbox : https://codesandbox.io/s/react-big-calendar-6oq3f

What’s the expected behavior?

  • The updated value of props should be passed

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
JesseyStendcommented, Sep 21, 2020

So I kinda fixed it by making a wrapper class component and passing the props over to the actual Calendar like this.

class ScheduleWrapper extends React.Component {
  render() {
    return (
      <DragAndDropCalendar
        {...this.props}
        components={{
          toolbar: (toolbar) => CustomToolbar(toolbar, this.props.yourVariable),
        }}
      />
    );
  }
}

const YourComponent = ({ }) => {

return (
      <ScheduleWrapper
        yourVariable={yourVariable}
        yourOtherPropsLikeEventsAndSettings
      />
  );
}
1reaction
shubhambisht541commented, Nov 9, 2020

@JesseyStend @alisakova Any update on this the custom toolbar is not working with drag and drop on react-big-calender ??

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-draggable not working with custom components
You have to give your component a rest prop. You need to do this because DraggableCore copies the component and puts several event...
Read more >
How to implement drag and drop in React with React DnD
The component is straightforward, but let's take a closer look at the code. useDropzone exposes several methods and variables for us to create ......
Read more >
How to Add Drag and Drop in React with React Beautiful DnD
We'll be using the Draggable component, which again, similar to the Droppable component, will include a function where we'll pass through props ......
Read more >
FAQ - React DnD
How do I make the component draggable only by a small handle? ... Specify the container node as the dragPreview , but only...
Read more >
The List Component - React-admin - Marmelab
For example, you can hide the <CreateButton> when the user doesn't have the right ... You can use the empty prop to replace...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found