Skip to content

Commit

Permalink
deleted componentWillReceiveProps to stop min reset (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
MelMepham authored and hew committed Apr 4, 2018
1 parent a55e21e commit c0336bc
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/react-scroll-horizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export default class HorizontalScroll extends Component {
&& this.state.animValues === nextState.animValues) {
return false
}
if (true

if (true
&& this.props.children === nextProps.children
&& this.caniscroll() === false) {
return false
Expand All @@ -77,19 +77,12 @@ export default class HorizontalScroll extends Component {
return true
}

componentWillReceiveProps(nextProps) {
if (this.props.children !== nextProps.children) {
// Reset container offset
this.resetMin()
}
}

caniscroll() {
let el = DOM.findDOMNode(this.hScrollParent)
let rect = el.getBoundingClientRect()
let scroller = el.firstElementChild

return scroller.offsetLeft < rect.left
return scroller.offsetLeft < rect.left
|| (scroller.offsetLeft + scroller.offsetWidth > rect.width)
}

Expand Down

0 comments on commit c0336bc

Please sign in to comment.