diff --git a/src/routes/-/RootLayout/components/Navigation/Navigation.tsx b/src/routes/-/RootLayout/components/Navigation/Navigation.tsx index 5cd850d..846c9aa 100644 --- a/src/routes/-/RootLayout/components/Navigation/Navigation.tsx +++ b/src/routes/-/RootLayout/components/Navigation/Navigation.tsx @@ -168,9 +168,19 @@ export default function Navigation() { const [menuOpen, setMenuOpen] = useState(0); const navRef = useRef(null); - const viewportHeight = useTelegramViewportValue("height"); - const stableHeight = useTelegramViewportValue("stableHeight"); - const isKeyboardVisible = stableHeight - viewportHeight > 100; + const [isKeyboardVisible, setIsKeyboardVisible] = useState(false); + + useEffect(() => { + const vv = window.visualViewport; + if (!vv) return; + + const onResize = () => { + setIsKeyboardVisible(vv.height < window.innerHeight * 0.75); + }; + + vv.addEventListener("resize", onResize); + return () => vv.removeEventListener("resize", onResize); + }, []); const handleOutsideClick = useCallback((e: MouseEvent) => { if (navRef.current && !navRef.current.contains(e.target as Node)) {