digidem / react-dimensions

[Looking for maintainers]
http://lab.digital-democracy.org/react-dimensions/
450 stars 77 forks source link

ReactDOMServer stops rendering on react-dimensions decorated components #56

Open aeneasr opened 8 years ago

aeneasr commented 8 years ago

I want to render a react app to a string and am using the ReadDOMServer to do so:

ReactDOMServer.renderToStaticMarkup(<EditorComponent store={this.props.store} id={this.props.id}` />)

However, I have a component that is wrapped by dimensions:

class Editable extends Component {
  // ...
}

export default dimensions()(Editable)

With the dimensions decorator in there, the ReactDOMServer stops rendering all children there. Markup looks something like this:

<div>
  <div style="width:100%;height:100%;padding:0;border:0;"></div>
</div>

while it should look something like this:

<div>
  <div style="width:100%;height:100%;padding:0;border:0;">
    <p> cool text </p>
  </div>
</div>

Removing the dimensions() decorator yields the desired result but breaks other logic that depends on dimensions:

<div>
  <p> cool text </p>
</div>