From dc5c9b3673fc0650e03a80f8bc2d13b0a951e37a Mon Sep 17 00:00:00 2001 From: Cosmo Date: Thu, 23 Apr 2026 09:22:55 +0000 Subject: [PATCH] fix(home): remove black flash between tab switches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AnimatePresence mode=wait keeps the DOM empty while the outgoing tab finishes its exit transition (200ms) before mounting the incoming tab. On touch devices this shows as a brief black frame — reported as экран остается черным. - Switch to mode=sync: outgoing fades out while incoming fades in, no gap. initial=false suppresses the enter animation on first render. - Drop the y: 12 → -8 slide (cheap jank on hydration), keep just opacity. Duration 200ms → 150ms for snappier feel. --- app/page.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 96ca9bc..dca5107 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -960,9 +960,9 @@ function SettingsTab({ city, onCityChange, onLogout, theme, onThemeChange }: { c // ————— Tab animation variants ————— const tabVariants = { - enter: { opacity: 0, y: 12 }, - center: { opacity: 1, y: 0 }, - exit: { opacity: 0, y: -8 }, + enter: { opacity: 0 }, + center: { opacity: 1 }, + exit: { opacity: 0 }, } // ————— Main ————— @@ -1125,15 +1125,15 @@ function HomePageInner() {
- + {tab === 'home' && ( - + )} {tab === 'devices' && ( - +
{devicesInRoom.length === 0 ? ( @@ -1153,19 +1153,19 @@ function HomePageInner() { )} {tab === 'calendar' && ( - + )} {tab === 'notes' && ( - + )} {tab === 'settings' && ( - + )}