React: calendar.get() does not return datepicker instance


I’m using F7 React and I’d like to get an instance of a calendar datepicker to use the calendar.setValue(values). However, I cannot seem to get any instance of the calendar. This statement returns undefined:


any ideas?

You shouldn’t do it in react, to updated calendar value you need to pass/change “value” prop of the input component

Thank you for your quick response.

I’d like to change the value from outside the component. That works fine with all other input types in f7-react, if your state is managed by mobx / mobx-react. However, mobx / react does not seem to trigger the update cycle for the change in value of the datepicker. That is why I want to update the value manually. But, I can’t seem to get the calendar instance.

I tried overriding the input value using Dom7, but that does not change the highlighted value in the calendar popover / modal sheet when I open the calendar again.

Try with this

this.$f7.calendar.get('#my-calendar-id > .calendar')