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