Calendar: fix the unnecessary recration of closures.

master
Tom Hacohen 7 years ago
parent 0d6ecfdbdf
commit 5a1b3af9b0

@ -9,6 +9,19 @@ import { EventType } from '../pim-types';
moment.locale('en-gb'); moment.locale('en-gb');
BigCalendar.momentLocalizer(moment); BigCalendar.momentLocalizer(moment);
function eventPropGetter(event: EventType) {
return {
style: {
backgroundColor: event.color,
}
};
}
function agendaHeaderFormat(date: {start: Date, end: Date}, culture: string, localizer: any) {
const format = 'll';
return localizer.format(date.start, format) + ' - ' + localizer.format(date.end, format);
}
class Calendar extends React.PureComponent { class Calendar extends React.PureComponent {
state: { state: {
currentDate?: Date; currentDate?: Date;
@ -25,19 +38,6 @@ class Calendar extends React.PureComponent {
} }
render() { render() {
function eventPropGetter(event: EventType) {
return {
style: {
backgroundColor: event.color,
}
};
}
function agendaHeaderFormat(date: {start: Date, end: Date}, culture: string, localizer: any) {
const format = 'll';
return localizer.format(date.start, format) + ' - ' + localizer.format(date.end, format);
}
return ( return (
<div style={{width: '100%', height: 500, padding: 10}}> <div style={{width: '100%', height: 500, padding: 10}}>
<BigCalendar <BigCalendar

Loading…
Cancel
Save