From e5ed6d0401892eabebd5bd226755cbf5f5ca927c Mon Sep 17 00:00:00 2001 From: c0mrade Date: Mon, 9 Feb 2026 10:48:25 +0300 Subject: [PATCH] fix: hide Telegram back button on bottom nav pages Back button was showing on all non-root routes including top-level pages reachable from the bottom navigation menu (subscription, balance, referral, support, wheel). These pages don't need a back button since users navigate between them via the bottom tab bar. --- src/AppWithNavigator.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AppWithNavigator.tsx b/src/AppWithNavigator.tsx index 53ec831..6f6dfeb 100644 --- a/src/AppWithNavigator.tsx +++ b/src/AppWithNavigator.tsx @@ -20,6 +20,9 @@ import { isInTelegramWebApp } from './hooks/useTelegramSDK'; * Manages Telegram BackButton visibility based on navigation location. * Shows back button on non-root routes, hides on root. */ +/** Pages reachable from bottom nav — treat as top-level (no back button). */ +const BOTTOM_NAV_PATHS = ['/', '/subscription', '/balance', '/referral', '/support', '/wheel']; + function TelegramBackButton() { const location = useLocation(); const navigate = useNavigate(); @@ -27,9 +30,9 @@ function TelegramBackButton() { navigateRef.current = navigate; useEffect(() => { - const isRoot = location.pathname === '/' || location.pathname === ''; + const isTopLevel = location.pathname === '' || BOTTOM_NAV_PATHS.includes(location.pathname); try { - if (isRoot) { + if (isTopLevel) { hideBackButton(); } else { showBackButton();