DatePicker component does not work.
I try to use material-ui in my react project. 'npm install material-ui' was failed when my react.js version is 0.14.0. Then I upgraded react.js to 0.14.1, 'npm install' works! So now I got
"material-ui": "^0.13.0", "react": "^0.14.1", "react-tap-event-plugin": "^0.2.1"
In my code, I added
const DatePicker = require('material-ui/lib/date-picker');
then I got the following error message on my PC chrome browser:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of Filter.
invariant.js:39 Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of Filter.
I tried AppBar, and it works.
var AppBar = require('material-ui/lib/app-bar');
Please help...
Your const DatePicker = require('material-ui/lib/date-picker'); import is wrong.
@shaurya947 There is at least 10 open issues with a similar wrong import... I think we really need to add it to the documentation.
@oliviertassinari agreed. @andjarnic also brought this up in the gitter room.
@andjarnic, would you like to fix these issues with a PR to update the components' docs with the right import statements? Let us know.
Thanks for pointing it out. But what's the correct import statement then? I also tried const DatePicker = require('material-ui/lib/date-picker/index');
it still does not work.
ok. I just got it work. The correct import statement is:
const DatePicker = require('material-ui/lib/date-picker/date-picker');
There are a bunch of files in /date-picker directory. Which one should we use? Is there any document for date-picker-dialog.js? What are other components (e.g., calendar-month.js, calendar.js, etc) for?
ok. I just got it work. The correct import statement is:
const DatePicker = require('material-ui/lib/date-picker/date-picker');
Good to hear it.
There are a bunch of files in /date-picker directory. Which one should we use?
We are only exposing two components, see https://github.com/callemall/material-ui/blob/master/src/date-picker/index.js.
We are going to improve the documentation with better examples (the all source code)