eiriklv / react-masonry-component

A React.js component for using @desandro's Masonry
MIT License
1.44k stars 145 forks source link

disableImagesLoaded not parsing boolean value #8

Closed thespacecadette closed 8 years ago

thespacecadette commented 8 years ago

Hi guys,

Having an issue with Masonry Component's parameter "disableImagesLoaded". It throws this error:

Uncaught TypeError: Cannot read property 'bool' of undefined

I've tried parsing false and creating a variable with false, but doesn't seem to work.

Is anyone else having issues with this?

thespacecadette commented 8 years ago

(bump)

levity commented 8 years ago
var Masonry = require('react-masonry-component')(React);

Are you sure you have the (React) part on the end?

eiriklv commented 8 years ago

It should probably have been changed to use peerDependencies instead, so that you don't have to inject React as a dependency

thespacecadette commented 8 years ago

This worked

import Masonry from 'masonry';
const masonry = Masonry(React);
afram commented 8 years ago

@thespacecadette This should now work differently in 3.0.0

You can give the 3.0.0 beta a spin if you like.

npm install react-masonry-component@3.0.0-rc.1

This version no longer requires passing in React as an argument, you can require the component and use it straight away. More info in the Readme

john-osullivan commented 8 years ago

Tried in 3.0.0-rc.1, got this error:

Error: Cannot resolve module 'eventEmitter/EventEmitter' in C:\...\react-masonry-component\node_modules\imagesLoaded

Then a number of similar ones for outlayer, 'get-size', and 'fizzy-ui-utils'. I'm combining Meteor and React, so maybe there's something weird going on based on the Meteor build process? Going to try and do what @thespacecadette said instead.

afram commented 8 years ago

@john-osullivan that shouldn't work with 3.0.0 because the API has changed.

Your issue is because 'eventEmitter/EventEmitter' (and all the others) are AMD dependencies. Are you using Webpack by any chance? If so you need to add the loader as per the readme.

If not using webpack, are you using AMD?

afram commented 8 years ago

It seems this might be a Meteor specific thing, I think it warrants it's own issue. I will close this one and open another as this issue is for a different matter.