souporserious / react-measure

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

PropType error: children must be single ReactElement #116

Closed taikn closed 6 years ago

taikn commented 6 years ago

With the latest update (2.1.1) I get warnings like these:

Warning: Failed prop type: Invalid prop `children` of type `function` supplied to `_class`, expected a single ReactElement.

Which are caused by this line here:

https://github.com/souporserious/react-measure/blob/d18b065a32eb9c63f47b225269992a4f16a6b39a/src/with-content-rect.js#L18

Maybe it can be altered to something more loose to accommodate both Functions and ReactElements?


children: PropTypes.oneOfType([PropTypes.element, PropTypes.func])