mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 10:27:49 +00:00
Update ConnectionModal.tsx
This commit is contained in:
@@ -113,10 +113,13 @@ function detectPlatform(): string | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function useIsMobile() {
|
function useIsMobile() {
|
||||||
const [isMobile, setIsMobile] = useState(false)
|
// Initialize synchronously to avoid flash between desktop/mobile layouts
|
||||||
|
const [isMobile, setIsMobile] = useState(() => {
|
||||||
|
if (typeof window === 'undefined') return false
|
||||||
|
return window.innerWidth < 768
|
||||||
|
})
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const check = () => setIsMobile(window.innerWidth < 768)
|
const check = () => setIsMobile(window.innerWidth < 768)
|
||||||
check()
|
|
||||||
window.addEventListener('resize', check)
|
window.addEventListener('resize', check)
|
||||||
return () => window.removeEventListener('resize', check)
|
return () => window.removeEventListener('resize', check)
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
Reference in New Issue
Block a user