fix: 🐛
This commit is contained in:
@@ -30,12 +30,14 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
const scrollTop = scrollAreaRef.current?.scrollTop || 0
|
const scrollTop = scrollAreaRef.current?.scrollTop || 0
|
||||||
if (scrollTop > lastScrollTop) {
|
const diff = scrollTop - lastScrollTop
|
||||||
|
if (diff > 20) {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
} else {
|
|
||||||
setVisible(true)
|
|
||||||
}
|
|
||||||
setLastScrollTop(scrollTop)
|
setLastScrollTop(scrollTop)
|
||||||
|
} else if (diff < -20) {
|
||||||
|
setVisible(true)
|
||||||
|
setLastScrollTop(scrollTop)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollArea = scrollAreaRef.current
|
const scrollArea = scrollAreaRef.current
|
||||||
|
|||||||
Reference in New Issue
Block a user