Skip to content

Setting a view as 'false' in views prop should turn it off #2316

@kronaemmanuel

Description

@kronaemmanuel

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/s/react-big-calendar-example-forked-o0b8z0?file=/src/App.js

Bug description

The documentation for creating a custom view shows this pattern being used:

const {views, ...otherProps} = useMemo(() => ({
  views: {
    month: true,
    week: CustomWeekView,
    day: true
  },
  // ... other props
}), [])

This makes it seem like if I pass day: false, the day view will disappear. However, that's not the case.

I would be happy to explore the codebase a little and fix this. Lemme know.

Expected Behavior

The day view should disappear when day: false is passed to the views prop.

Actual Behavior

The day view still appears, and it displays the error: View.title is not a function because it is still expecting for there to be a view there.

react-big-calendar version

1.5.0

React version

18.2.0

Platform/Target and Browser Versions

Firefox 104.0

Validations

  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a react-big-calendar issue and not an implementation issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions