Skip to content

Commit c0336bc

Browse files
MelMephamhew
authored andcommitted
deleted componentWillReceiveProps to stop min reset (#29)
1 parent a55e21e commit c0336bc

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/react-scroll-horizontal.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export default class HorizontalScroll extends Component {
6767
&& this.state.animValues === nextState.animValues) {
6868
return false
6969
}
70-
71-
if (true
70+
71+
if (true
7272
&& this.props.children === nextProps.children
7373
&& this.caniscroll() === false) {
7474
return false
@@ -77,19 +77,12 @@ export default class HorizontalScroll extends Component {
7777
return true
7878
}
7979

80-
componentWillReceiveProps(nextProps) {
81-
if (this.props.children !== nextProps.children) {
82-
// Reset container offset
83-
this.resetMin()
84-
}
85-
}
86-
8780
caniscroll() {
8881
let el = DOM.findDOMNode(this.hScrollParent)
8982
let rect = el.getBoundingClientRect()
9083
let scroller = el.firstElementChild
9184

92-
return scroller.offsetLeft < rect.left
85+
return scroller.offsetLeft < rect.left
9386
|| (scroller.offsetLeft + scroller.offsetWidth > rect.width)
9487
}
9588

0 commit comments

Comments
 (0)