Skip to content

Commit d1c31c2

Browse files
authored
fix: warning defaultProps in Agenda (#2620)
Signed-off-by: Mychael Go <admin@mychaelgo.com>
1 parent 7d9d1c5 commit d1c31c2

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/Agenda.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import { navigate } from './utils/constants'
99
import { inRange } from './utils/eventLevels'
1010
import { isSelected } from './utils/selection'
1111

12+
const DEFAULT_LENGTH = 30;
1213
function Agenda({
1314
accessors,
1415
components,
1516
date,
1617
events,
1718
getters,
18-
length,
19+
length = DEFAULT_LENGTH,
1920
localizer,
2021
onDoubleClickEvent,
2122
onSelectEvent,
@@ -217,19 +218,15 @@ Agenda.propTypes = {
217218
selected: PropTypes.object,
218219
}
219220

220-
Agenda.defaultProps = {
221-
length: 30,
222-
}
223-
224-
Agenda.range = (start, { length = Agenda.defaultProps.length, localizer }) => {
221+
Agenda.range = (start, { length = DEFAULT_LENGTH, localizer }) => {
225222
let end = localizer.add(start, length, 'day')
226223
return { start, end }
227224
}
228225

229226
Agenda.navigate = (
230227
date,
231228
action,
232-
{ length = Agenda.defaultProps.length, localizer }
229+
{ length = DEFAULT_LENGTH, localizer }
233230
) => {
234231
switch (action) {
235232
case navigate.PREVIOUS:
@@ -243,7 +240,7 @@ Agenda.navigate = (
243240
}
244241
}
245242

246-
Agenda.title = (start, { length = Agenda.defaultProps.length, localizer }) => {
243+
Agenda.title = (start, { length = DEFAULT_LENGTH, localizer }) => {
247244
let end = localizer.add(start, length, 'day')
248245
return localizer.format({ start, end }, 'agendaHeaderFormat')
249246
}

0 commit comments

Comments
 (0)