Skip to content

Commit 0e6b771

Browse files
authored
fix: correct treatment of boolean view in 'views' (jquense#2368)
1 parent 6cd3a4b commit 0e6b771

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Calendar.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@ import mapValues from 'lodash/mapValues'
2626
import { wrapAccessor } from './utils/accessors'
2727

2828
function viewNames(_views) {
29-
return !Array.isArray(_views) ? Object.keys(_views) : _views
29+
if (Array.isArray(_views)) {
30+
return _views
31+
}
32+
const views = []
33+
for (const [key, value] of Object.entries(_views)) {
34+
if (value) {
35+
views.push(key)
36+
}
37+
}
38+
return views
3039
}
3140

3241
function isValidView(view, { views: _views }) {
@@ -47,7 +56,7 @@ class Calendar extends React.Component {
4756
* const localizer = globalizeLocalizer(globalize)
4857
* ```
4958
* moment
50-
* ```js
59+
* ``js
5160
* import {momentLocalizer} from 'react-big-calendar'
5261
* import moment from 'moment'
5362
* // and, for optional time zone support

0 commit comments

Comments
 (0)