Update ConnectionModal.tsx

This commit is contained in:
Egor
2026-01-20 13:50:37 +03:00
committed by GitHub
parent 07a635e1a7
commit e797b1e282

View File

@@ -113,10 +113,13 @@ function detectPlatform(): string | null {
}
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(() => {
const check = () => setIsMobile(window.innerWidth < 768)
check()
window.addEventListener('resize', check)
return () => window.removeEventListener('resize', check)
}, [])