meteor-utilities / react-list-container

Smart containers for React & Meteor
32 stars 8 forks source link

Astronomy support #12

Open ochicf opened 8 years ago

ochicf commented 8 years ago

Hi,

first of all I want to thank you for the great package. I've just started using it and it greatly reduced the amount and complexity of the code needed to list documents.

The reason for opening this issue is to ask for Astronomy support, since now it cannot be used because the collection prop type is expected to be an object, but astronomy classes are functions instead (designed to be object constructors). This classes wrap the mongo collection and mantain some of its methods and properties, so I think it may be easy to adapt the package. I don't know which would be the best approach to do so, though.

Just for testing purposes I've forked and modified the following code it ListContainer.jsx:

ListContainer.propTypes = {
  collection: React.PropTypes.oneOfType([
    React.PropTypes.object,
    React.PropTypes.func
  ]).isRequired,
  // rest of prop types
}

Now I can pass an Astronomy Class as the collection prop and the resulting documents are Astronomy docs, so it is working as I'd expect.

SachaG commented 8 years ago

I don't use Astronomy myself so I can't really work on this, sorry… I would accept a PR though.

ochicf commented 8 years ago

Created a PR adding support for Astronomy.