fix: 🐛
This commit is contained in:
@@ -45,20 +45,26 @@ const PrimaryPageLayout = forwardRef(
|
|||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isSmallScreen) {
|
if (!isSmallScreen) return
|
||||||
if (smallScreenScrollAreaRef.current?.checkVisibility()) {
|
|
||||||
window.scrollTo({ top: smallScreenLastScrollTopRef.current, behavior: 'instant' })
|
const isVisible = () => {
|
||||||
}
|
return smallScreenScrollAreaRef.current?.checkVisibility
|
||||||
const handleScroll = () => {
|
? smallScreenScrollAreaRef.current?.checkVisibility()
|
||||||
if (smallScreenScrollAreaRef.current?.checkVisibility()) {
|
: false
|
||||||
smallScreenLastScrollTopRef.current = window.scrollY
|
}
|
||||||
}
|
|
||||||
}
|
if (isVisible()) {
|
||||||
window.addEventListener('scroll', handleScroll)
|
window.scrollTo({ top: smallScreenLastScrollTopRef.current, behavior: 'instant' })
|
||||||
return () => {
|
}
|
||||||
window.removeEventListener('scroll', handleScroll)
|
const handleScroll = () => {
|
||||||
|
if (isVisible()) {
|
||||||
|
smallScreenLastScrollTopRef.current = window.scrollY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.addEventListener('scroll', handleScroll)
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('scroll', handleScroll)
|
||||||
|
}
|
||||||
}, [current, isSmallScreen, display])
|
}, [current, isSmallScreen, display])
|
||||||
|
|
||||||
if (isSmallScreen) {
|
if (isSmallScreen) {
|
||||||
|
|||||||
Reference in New Issue
Block a user