I'm getting the titled error using react fullcalendar on mobile view only. When I'm in desktop view everything is working fine. The code is the below:
function CalendarPage() {
const [currentEvents, setCurrentEvents] = useState(INITIAL_EVENTS);
console.log(currentEvents);
const handleDateSelect = (selectInfo) => {
let title = prompt('Please enter a new title for your event');
let calendarApi = selectInfo.view.calendar;
calendarApi.unselect(); // clear date selection
if (title) {
calendarApi.addEvent({
id: createEventId(),
title,
start: selectInfo.startStr,
end: selectInfo.endStr,
allDay: selectInfo.allDay
});
}
};
const handleEventClick = (clickInfo) => {
clickInfo.event.remove();
};
const handleEvents = (events) => {
setCurrentEvents({
currentEvents: events
});
};
function renderEventContent(eventInfo) {
return (
<>
<b>{eventInfo.timeText}</b>
<i>{eventInfo.event.title}</i>
</>
);
}
return (
<FullCalendar
plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
headerToolbar={{
left: 'prev,next,today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
}}
initialView='dayGridMonth'
locale={el}
editable={true}
selectable={true}
selectMirror={true}
dayMaxEvents={true}
weekends={true}
initialEvents={currentEvents}
select={handleDateSelect}
eventContent={renderEventContent}
eventClick={handleEventClick}
eventsSet={handleEvents}
/>
);
}
I have read the documentation and the GitHub page but unfortunately didn't find a solution.
I have create a codesandbox to reproduce the error: link