From 4445833b83ee459c4af15be1017ad5e7e27d2a15 Mon Sep 17 00:00:00 2001 From: "Chuck Dries (via MelvinBot)" Date: Wed, 29 Jul 2026 14:39:48 +0000 Subject: [PATCH] Seed currentReportID on cold start so composer keyboard avoiding works on first report Co-authored-by: Chuck Dries --- src/libs/Navigation/NavigationRoot.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 7cc3f38ba7f0..2ccc04532347 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -290,7 +290,13 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N navigationIntegration.registerNavigationContainer(navigationRef); trackFullstoryPageView(navigationRef.getRootState()); setupNavigationFocusReturn(); - }, [onReady]); + + // React Navigation does not fire onStateChange for the initial state, so on a cold start that + // restores directly into a report (via initialState) currentReportID would stay unset. Seed it + // from the restored root state so isTopMostReportId is correct on the first report screen + // (e.g. the composer's keyboard avoiding view is enabled right away). + updateCurrentReportID(navigationRef.getRootState()); + }, [onReady, updateCurrentReportID]); // Re-establish on (re)mount — StrictMode's cleanup-then-remount otherwise leaves us listener-less; setup is idempotent. useEffect(() => {