Solvedreact dates Errors when upgrading to latest react-dates

upgrading from 12.1.0 to 13.0.3

After installing the new module running into these errors, I think its something to do w/ storybook?

Uncaught TypeError: Cannot read property 'theme' of undefined

and

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `SearchFilters`.

and

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `SearchFilters`.

Wondering if anyone else ran into these, and if there is a fix for them. Thanks in advanced!

41 Answers

✔️Accepted Answer

Please read the docs - did you import 'react-dates/initialize' at the top of your app?

Other Answers:

I think 1 and then 2 seems like the right call. I'm not super familiar with webpack and my bandwidth is def... very overwhelmed right now, but I can try and sit down with folks here to see what we can do to address this (when I get back from PTO in two weeks).

This one is no longer found and it was providing the main styles for the component I believe.
import '!style-loader!css-loader!react-dates/lib/css/_datepicker.css'

import 'react-dates/initialize' fixes the Uncaught TypeError: Cannot read property 'theme' of undefined but not the

ERROR in ./node_modules/playa-styleguide/src/components/DatePicker/DatePicker.js
Module not found: Error: Can't resolve 'react-dates/lib/css/_datepicker.css' in '/Users/jeremyazzari/Workspace/h1/hyfn8_front_end_app/node_modules/playa-styleguide/src/components/DatePicker'