diff --git a/src/Measure.jsx b/src/Measure.jsx index ba8b363..5ba1534 100644 --- a/src/Measure.jsx +++ b/src/Measure.jsx @@ -1,8 +1,12 @@ import React from 'react' +import PropTypes from 'prop-types' import withContentRect from './with-content-rect' -function Measure({ measure, measureRef, contentRect, children }) { +const Measure = withContentRect()(function Measure ({ measure, measureRef, contentRect, children }) { return children({ measure, measureRef, contentRect }) -} +}) -export default withContentRect()(Measure) +Measure.displayName = 'Measure' +Measure.propTypes.children = PropTypes.func + +export default Measure diff --git a/src/with-content-rect.js b/src/with-content-rect.js index e109a89..d599e7e 100644 --- a/src/with-content-rect.js +++ b/src/with-content-rect.js @@ -6,7 +6,7 @@ import getContentRect from './get-content-rect' function withContentRect(types) { return WrappedComponent => - class extends Component { + class WithContentRect extends Component { static propTypes = { client: PropTypes.bool, offset: PropTypes.bool, @@ -15,7 +15,6 @@ function withContentRect(types) { margin: PropTypes.bool, innerRef: PropTypes.func, onResize: PropTypes.func, - children: PropTypes.element, } state = {