From 3074619d3709e3afd045db4659f05b205c13b015 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Wed, 4 Feb 2026 16:53:47 -0800 Subject: [PATCH 1/2] Fix test drive modal appearing twice and tab unresponsiveness --- src/hooks/useOnboardingFlow.ts | 25 +++++++++++-------- .../Navigation/AppNavigator/AuthScreens.tsx | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/hooks/useOnboardingFlow.ts b/src/hooks/useOnboardingFlow.ts index 8bbb7d03d439a..6f69a13046af7 100644 --- a/src/hooks/useOnboardingFlow.ts +++ b/src/hooks/useOnboardingFlow.ts @@ -78,17 +78,22 @@ function useOnboardingFlowRouter() { // Should be removed once Test Drive modal route has its own navigation guard // Details: https://github.com/Expensify/App/pull/79898 if (hasCompletedGuidedSetupFlowSelector(onboardingValues) && onboardingValues?.testDriveModalDismissed === false) { - Navigation.setNavigationActionToMicrotaskQueue(() => { - Log.info('[Onboarding] User has not completed the guided setup flow, starting onboarding flow from test drive modal'); - startOnboardingFlow({ - onboardingInitialPath: ROUTES.TEST_DRIVE_MODAL_ROOT.route, - isUserFromPublicDomain: false, - hasAccessiblePolicies: false, - currentOnboardingCompanySize: undefined, - currentOnboardingPurposeSelected: undefined, - onboardingValues, + const navigationState = navigationRef.getRootState(); + const lastRoute = navigationState.routes.at(-1); + // Prevent duplicate navigation if the test drive modal is already shown + if (lastRoute?.name !== NAVIGATORS.TEST_DRIVE_MODAL_NAVIGATOR) { + Navigation.setNavigationActionToMicrotaskQueue(() => { + Log.info('[Onboarding] User has not completed the guided setup flow, starting onboarding flow from test drive modal'); + startOnboardingFlow({ + onboardingInitialPath: ROUTES.TEST_DRIVE_MODAL_ROOT.route, + isUserFromPublicDomain: false, + hasAccessiblePolicies: false, + currentOnboardingCompanySize: undefined, + currentOnboardingPurposeSelected: undefined, + onboardingValues, + }); }); - }); + } } if (hasBeenAddedToNudgeMigration && !isProductTrainingElementDismissed('migratedUserWelcomeModal', dismissedProductTraining)) { const navigationState = navigationRef.getRootState(); diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index fedbeeb63ff7c..60745d320a294 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -668,6 +668,7 @@ function AuthScreens() { name={NAVIGATORS.TEST_DRIVE_MODAL_NAVIGATOR} options={rootNavigatorScreenOptions.basicModalNavigator} component={TestDriveModalNavigator} + listeners={modalScreenListeners} /> Date: Thu, 5 Feb 2026 01:11:51 +0000 Subject: [PATCH 2/2] Remove unnecessary comment Co-authored-by: Jules --- src/hooks/useOnboardingFlow.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hooks/useOnboardingFlow.ts b/src/hooks/useOnboardingFlow.ts index 6f69a13046af7..c67e51c278a13 100644 --- a/src/hooks/useOnboardingFlow.ts +++ b/src/hooks/useOnboardingFlow.ts @@ -80,7 +80,6 @@ function useOnboardingFlowRouter() { if (hasCompletedGuidedSetupFlowSelector(onboardingValues) && onboardingValues?.testDriveModalDismissed === false) { const navigationState = navigationRef.getRootState(); const lastRoute = navigationState.routes.at(-1); - // Prevent duplicate navigation if the test drive modal is already shown if (lastRoute?.name !== NAVIGATORS.TEST_DRIVE_MODAL_NAVIGATOR) { Navigation.setNavigationActionToMicrotaskQueue(() => { Log.info('[Onboarding] User has not completed the guided setup flow, starting onboarding flow from test drive modal');