问题
The customised events are rendered as expected, but the day cells don't grow in height to include the events at the initial load. If I change the size of the window, or click on another view, and change back to the month view, it renders correctly. Then if an event is triggered (date click or event click), the calendar rerenders the same way as the initial load.
I tried rerendering the calendar in 'datesRender' function with this.render(), but it's not ideal to load everything twice, also it has a flicking effect when clicking on a date or event.
...
const renderEvent = ({ event, el }) => {
const eventComponent = (
<div className="wrapper">
Event content here
</div>
);
ReactDOM.render(eventComponent, el);
};
...
<FullCalendar
defaultView='dayGridMonth'
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
header={{
left: 'prevYear,nextYear',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay today prev,next'
}}
weekends={true}
events={events}
dateClick={handleDateClick}
handleWindowResize={true}
eventRender={renderEvent}
eventClick={function(info) {
handleEventClick(info.event.id);
}}
datesRender={function(info) {
// this.render();
}}
/>
...
I would like the calendar render properly with the initial load.
来源:https://stackoverflow.com/questions/56289522/fullcalendar-doesnt-adjust-the-height-of-cells-with-customised-events-when-firs