Skip to content

Commit

Permalink
If the props.children change.Recompute the Swipe And Rerender the com…
Browse files Browse the repository at this point in the history
…ponent.
  • Loading branch information
王麟 committed Mar 3, 2016
1 parent dd57612 commit bf8df54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion react-swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,17 @@
shouldComponentUpdate: function (nextProps) {
return (
(this.props.slideToIndex !== nextProps.slideToIndex) ||
(typeof this.props.shouldUpdate !== 'undefined') && this.props.shouldUpdate(nextProps, this.props)
(typeof this.props.shouldUpdate !== 'undefined') &&
this.props.shouldUpdate(nextProps, this.props) ||
(nextProps.children!==this.props.children)
);
},
componentWillReceiveProps:function(newProps){
if(this.swipe!=null){
this.swipe.kill();
}
this.swipe = Swipe(this.getDOMNode(), this.props);
},

render: function() {
return React.createElement('div', React.__spread({}, {style: objectAssign({}, styles.container, this.props.containerStyles)}, this.props),
Expand Down

0 comments on commit bf8df54

Please sign in to comment.