tleunen / react-mdl

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

Allow iterables as prop types similar to react core. #369

Closed ahoereth closed 8 years ago

ahoereth commented 8 years ago

See issue #359.

Uses react's getIteratorFn() to check weather the passed prop can be iterated. Currently I do not check for valid child items.. Not sure whether that's required? Would cause quite a bit of overhead.

Side note: Does this make sense for any other react-mdl component? Did not find anything where immutable (or similar) props make sense.

codecov-io commented 8 years ago

Current coverage is 98.91% (diff: 0.00%)

Merging #369 into master will decrease coverage by 0.42%

@@             master       #369   diff @@
==========================================
  Files           107        107          
  Lines          2107       2116     +9   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           2093       2093          
- Misses           14         23     +9   
  Partials          0          0          

Powered by Codecov. Last update 191a863...45699c2

tleunen commented 8 years ago

If the user pass an immutable-js list instead of a plain array, and we're using array functions on it, how will it work on the immutable-js structure? Does it has the same functions?

Like, .lenth(), .slice(), .map, etc?

ahoereth commented 8 years ago

There is no length property, slice(), map() etc work the same. For all the available functions see the sidebar in the immutablejs docs -- they mostly correspond to their JS/ES6 equivalents, especially to the new ES6 Map type.

...and I just figured: This makes a lot more changes necessary. Seems like the code just seemingly works fine as is, but actually does not. Will need to add immutablejs as dev dependency to test this thoroughly.

ahoereth commented 8 years ago

I won't have time to complete this PR in a timely manner, using a simplified custom DataTable for now. Closing this for now, hope to come back to it later.