souporserious / react-measure

📏 Compute measurements of a React component.
https://souporserious.github.io/react-measure/
MIT License
1.94k stars 109 forks source link

CodePen Support #59

Open anthonygreco opened 7 years ago

anthonygreco commented 7 years ago

Any idea what's not right about this CodePen?

souporserious commented 7 years ago

Sorry I just saw this, not sure what you mean? It seems to be working for me.

anthonygreco commented 7 years ago

There's no syntax error, but it still doesn't work. The handleResize method that should get called on window resize is never called and the render method should display the component's dimensions:

<MeasureComponent bounds onResize={this.handleResize}>
  {({ measureRef }) => (
    <div ref={measureRef} className='container'>
      {JSON.stringify(dimensions)}
    </div>
  )}
</MeasureComponent>

Worth noting, logging console.log('_resizeObserverPolyfill2', _resizeObserverPolyfill2); in the umd script returns:

"_resizeObserverPolyfill2" Object {
  default: undefined
}
souporserious commented 7 years ago

Ah I think it's because I have the Chrome flag turned on so it might be using the native one 😞 sorry about that. I'll work on fixing the dist build as soon as I can.

neptunian commented 7 years ago

Any news on this? I'd like to demo my component using react-measure but when I wrap it in nothing shows up.