From d57aae1829842b30b363caab4a634eac897d55cb Mon Sep 17 00:00:00 2001 From: xiaohuoni Date: Fri, 26 Oct 2018 16:05:19 +0800 Subject: [PATCH] fix slide hidden Header bug (#2681) * fix slide hidden Header bug Close :#2680 * Prevent repeated animation --- src/layouts/Header.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layouts/Header.js b/src/layouts/Header.js index 01402e30..6e092c88 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -93,13 +93,12 @@ class HeaderView extends PureComponent { } const scrollTop = document.body.scrollTop + document.documentElement.scrollTop; if (!this.ticking) { + this.ticking = true; requestAnimationFrame(() => { if (this.oldScrollTop > scrollTop) { this.setState({ visible: true, }); - this.scrollTop = scrollTop; - return; } if (scrollTop > 300 && visible) { this.setState({ @@ -115,7 +114,6 @@ class HeaderView extends PureComponent { this.ticking = false; }); } - this.ticking = false; }; render() { -- GitLab