Skip to content

Commit

Permalink
Merge pull request #117 from Hypnosphi/children-prop-type
Browse files Browse the repository at this point in the history
Move children propType from with-content-rect to Measure
  • Loading branch information
souporserious authored Sep 10, 2018
2 parents d18b065 + 7d0c8c7 commit be0031c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/Measure.jsx
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions src/with-content-rect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -15,7 +15,6 @@ function withContentRect(types) {
margin: PropTypes.bool,
innerRef: PropTypes.func,
onResize: PropTypes.func,
children: PropTypes.element,
}

state = {
Expand Down

0 comments on commit be0031c

Please # to comment.