Revert "Fix arrows updating issue when children change"

This reverts commit 3d42ef975f.
old
Mohammed Erraysy 2018-02-26 17:29:58 +00:00
parent 4347125901
commit 286c3f792e
1 changed files with 6 additions and 13 deletions

View File

@ -59,8 +59,6 @@ const factory = (Tab, TabContent, FontIcon) => {
if (index !== prevIndex || children !== prevChildren) { if (index !== prevIndex || children !== prevChildren) {
this.updatePointer(index); this.updatePointer(index);
} }
this.updateArrows();
} }
componentWillUnmount() { componentWillUnmount() {
@ -107,20 +105,15 @@ const factory = (Tab, TabContent, FontIcon) => {
const scrollLeft = this.navigationNode.scrollLeft; const scrollLeft = this.navigationNode.scrollLeft;
const nav = this.navigationNode.getBoundingClientRect(); const nav = this.navigationNode.getBoundingClientRect();
const lastLabel = this.navigationNode.children[idx].getBoundingClientRect(); const lastLabel = this.navigationNode.children[idx].getBoundingClientRect();
const left = scrollLeft > 0;
const right = nav.right < (lastLabel.right - 5);
const { left: prevLeft, right: prevRight } = this.state.arrows;
if (left !== prevLeft || right !== prevRight) {
this.setState({ this.setState({
arrows: { arrows: {
left, left: scrollLeft > 0,
right, right: nav.right < (lastLabel.right - 5),
}, },
}); });
} }
} }
}
scrollNavigation = (factor) => { scrollNavigation = (factor) => {
const oldScrollLeft = this.navigationNode.scrollLeft; const oldScrollLeft = this.navigationNode.scrollLeft;