fix: calendar day view - key-based remount workaround for react-big-calendar DnD
This commit is contained in:
@@ -255,7 +255,9 @@ function CalendarPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rbc-calendar-container" style={{ minHeight: isMobile ? 400 : 600 }}>
|
<div className="rbc-calendar-container" style={{ minHeight: isMobile ? 400 : 600 }}>
|
||||||
|
{/* Key={view} forces remount on view change (workaround for react-big-calendar DnD day view issue) */}
|
||||||
<DragAndDropCalendar
|
<DragAndDropCalendar
|
||||||
|
key={'cal-' + view + '-' + (isMobile ? 'm' : 'd')}
|
||||||
localizer={localizer}
|
localizer={localizer}
|
||||||
events={calendarEvents}
|
events={calendarEvents}
|
||||||
startAccessor="start"
|
startAccessor="start"
|
||||||
@@ -275,16 +277,7 @@ function CalendarPage() {
|
|||||||
showMultiDayTimes
|
showMultiDayTimes
|
||||||
components={{
|
components={{
|
||||||
event: EventComponent,
|
event: EventComponent,
|
||||||
toolbar: (props: any) => (
|
toolbar: (props: any) => <CustomToolbar {...props} currentView={view} />,
|
||||||
<CustomToolbar
|
|
||||||
{...props}
|
|
||||||
currentView={view}
|
|
||||||
onView={(newView: string) => {
|
|
||||||
props.onView(newView);
|
|
||||||
setView(newView);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
views={["month", "week", "work_week", "day", "agenda"]}
|
views={["month", "week", "work_week", "day", "agenda"]}
|
||||||
step={30}
|
step={30}
|
||||||
|
|||||||
Reference in New Issue
Block a user