Browse Source

fix: 🐛

imwald
codytseng 1 year ago
parent
commit
dd1fd83045
  1. 8
      src/renderer/src/layouts/PrimaryPageLayout/index.tsx

8
src/renderer/src/layouts/PrimaryPageLayout/index.tsx

@ -30,12 +30,14 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode @@ -30,12 +30,14 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
useEffect(() => {
const handleScroll = () => {
const scrollTop = scrollAreaRef.current?.scrollTop || 0
if (scrollTop > lastScrollTop) {
const diff = scrollTop - lastScrollTop
if (diff > 20) {
setVisible(false)
} else {
setLastScrollTop(scrollTop)
} else if (diff < -20) {
setVisible(true)
setLastScrollTop(scrollTop)
}
setLastScrollTop(scrollTop)
}
const scrollArea = scrollAreaRef.current

Loading…
Cancel
Save