Set currentView of calendar correctly when default view is not month (#1510)

This commit is contained in:
Sherfin Shamsudeen 2021-12-06 15:38:03 +05:30 committed by GitHub
parent f3828339cb
commit 828e35094e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Calendar as ReactCalendar, momentLocalizer } from 'react-big-calendar';
import moment from 'moment';
import 'react-big-calendar/lib/css/react-big-calendar.css';
@ -73,6 +73,11 @@ export const Calendar = function ({
? properties.defaultView
: allowedCalendarViews[0];
useEffect(() => {
setExposedVariable('currentView', defaultView);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [defaultView]);
const components = {
timeGutterHeader: () => <div style={{ height: '100%', display: 'flex', alignItems: 'flex-end' }}>All day</div>,
week: {