diff --git a/src/Position.js b/src/Position.js index a1b0b53..0a5664a 100644 --- a/src/Position.js +++ b/src/Position.js @@ -56,6 +56,8 @@ class Position extends React.Component { const {children, className, ...props} = this.props; const {positionLeft, positionTop, ...arrowPosition} = this.state; + Object.keys(Position.propTypes).forEach(key => delete props[key]); + const child = React.Children.only(children); return cloneElement( child, diff --git a/test/PositionSpec.js b/test/PositionSpec.js index e86224f..2578445 100644 --- a/test/PositionSpec.js +++ b/test/PositionSpec.js @@ -216,5 +216,22 @@ describe('Position', function () { }); }); + it('should not forward own props to child', function () { + let spiedProps; + const Child = (props) => { + spiedProps = props; + return
; + }; + + ReactTestUtils.renderIntoDocument( +