tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

Support for immutable-js objects #359

Open ahoereth opened 8 years ago

ahoereth commented 8 years ago

(Most?) react-mdl components, e.g. DataTable, only support js native arrays and objects as props. React itself also allows for direct use of immutable-js (and similar) datatypes since 0.13:

Support for iterators and immutable-js sequences as children.

Changing this behavior currently is as easy as replacing PropTypes.arrayOf(...) or similar with PropTypes.any.

I am currently planning on solving this using a function custom type checker testing the objects constructor name. Any input on this?

PropTypes.oneOfType([
  PropTypes.arrayOf(PropTypes.object),
  function(props, propName, componentName) { [...] },
])
tleunen commented 8 years ago

Great! How would you check if it's an iterator or immutable-js object?