From 51fc7958f2a88959a3734c5fbeacaf41329e106f Mon Sep 17 00:00:00 2001 From: ToffeeLu <363096085@qq.com> Date: Thu, 29 Nov 2018 16:48:59 +0800 Subject: [PATCH] fix header visible or hide in one `requestAnimationFrame` --- src/layouts/Header.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/Header.js b/src/layouts/Header.js index b7e7a759..4e35cf6f 100644 --- a/src/layouts/Header.js +++ b/src/layouts/Header.js @@ -99,12 +99,12 @@ class HeaderView extends PureComponent { visible: true, }); } - if (scrollTop > 300 && visible) { + else if (scrollTop > 300 && visible) { this.setState({ visible: false, }); } - if (scrollTop < 300 && !visible) { + else if (scrollTop < 300 && !visible) { this.setState({ visible: true, }); -- GitLab