Skip to content

Commit

Permalink
Merge pull request #44 from dogfessional/fix/react-unknown-prop-warning
Browse files Browse the repository at this point in the history
fix react unknown prop warning
  • Loading branch information
hartzis authored Jul 12, 2016
2 parents f1e1305 + 5289a7c commit 22162f6
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions src/Swipeable.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,32 @@ const Swipeable = React.createClass({
},

render: function () {
const newProps = {
...this.props,
onTouchStart: this.touchStart,
onTouchMove: this.touchMove,
onTouchEnd: this.touchEnd,
}

delete newProps.onSwiped
delete newProps.onSwiping
delete newProps.onSwipingUp
delete newProps.onSwipingRight
delete newProps.onSwipingDown
delete newProps.onSwipingLeft
delete newProps.onSwipedUp
delete newProps.onSwipedRight
delete newProps.onSwipedDown
delete newProps.onSwipedLeft
delete newProps.flickThreshold
delete newProps.delta
delete newProps.preventDefaultTouchmoveEvent
delete newProps.nodeName
delete newProps.children

return React.createElement(
this.props.nodeName,
{
...this.props,
onTouchStart: this.touchStart,
onTouchMove: this.touchMove,
onTouchEnd: this.touchEnd,
},
newProps,
this.props.children
);
}
Expand Down

0 comments on commit 22162f6

Please sign in to comment.