Commit d57aae18 authored by xiaohuoni's avatar xiaohuoni Committed by 陈帅

fix slide hidden Header bug (#2681)

* fix slide  hidden Header bug

Close :#2680

* Prevent repeated animation
parent bd0e5ae1
......@@ -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() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment