dantrain / react-stonecutter

Animated grid layout component for React
http://dantrain.github.io/react-stonecutter
MIT License
1.21k stars 72 forks source link

Not isomorphic friendly #22

Closed mkliu closed 7 years ago

mkliu commented 7 years ago

First I must say this is a great package! Easy to use (i actually find the Grid example component easier so I'm using that one).

I'm using React Starter Kit - www.reactstarterkit.com, isomorphic is great coz it allows my user to see content without any javascript being downloaded. But looks like this library isn't isomorphic friendly. Layout isn't calculated when I render from the server side, therefore even though my content is sent down on the initial load, but no UI is shown.

I'm not using responsive, so it should be doable to do layout on the sever side. Tried to do some debugging but can't find how to solve it. Any suggestions?

dantrain commented 7 years ago

Hi there,

Are you using measureItems? This can only do the measurement on the client. If you don't use this and set the itemHeight prop on the grid instead, you should be able to do layout and render on the server. Hope this helps!

mkliu commented 7 years ago

it's variable length content.. i think it's a pretty generic problem, especially with images getting involved. #23 is similar in this way.

dantrain commented 7 years ago

It is not possible to measure the height of a container with variable length content on the server, as the browser view engine needs to perform layout to determine it. Any suggestions welcome though!