Hi. I’m using Mobiscroll 5.19.2 (react), and when I switch from weekly view to monthly view then back to weekly view, I get this console error:
Uncaught TypeError: Cannot read properties of undefined (reading 'date')
at t._scrollToTime (mobiscroll.react.min.js:2:1)
at mobiscroll.react.min.js:2:1
This results in me seeing the week before the one I was on before I had changed to the monthly view. The views are in a state variable and it does work. These are my views:
const views: Views = {
month: { timeline: { type: 'month', eventList: true, resolution: 'day' } },
week: {
timeline: {
type: 'week',
startDay: 1,
endDay: 0,
resolution: 'day',
eventList: true,
},
},
};
I’m not setting a defaultSelectedDate or a selectedDate option. I’m letting the calendar decide based on the events I load into it. I load the events using the onPageLoading option where I put the events array into a state variable.
I re-fetch events from the server each time the date is changed in the header controls, or whenever the view is changed.
Please can I ask if there’s something I am doing wrong or missing?
(I should also say that if I don’t load any events or just keep the events array empty, then this error does not occur)