From 4cbb51d128d4b83a0c54deab1e1e13ffc3ccdd10 Mon Sep 17 00:00:00 2001 From: paulnjs Date: Tue, 21 Oct 2025 14:11:03 +0700 Subject: [PATCH 1/3] =?UTF-8?q?Onboarding=20modal=20overlaps=20Abracadabra?= =?UTF-8?q?=20you=E2=80=99re=20signed=20in!=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 2 +- src/libs/Navigation/Navigation.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 570d4ec12045..32b126088fe8 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -609,7 +609,7 @@ function AuthScreens() { component={FeatureTrainingModalNavigator} listeners={modalScreenListeners} /> - {isOnboardingCompleted === false && ( + {isOnboardingCompleted === false && !Navigation.isValidateLoginFlow() && ( Date: Tue, 28 Oct 2025 12:37:50 +0700 Subject: [PATCH 2/3] add test to cover isValidateLoginFlow --- src/libs/Navigation/Navigation.ts | 1 + tests/navigation/NavigationTests.tsx | 43 +++++++++++++++++++++++++ tests/utils/TestNavigationContainer.tsx | 4 +++ 3 files changed, 48 insertions(+) create mode 100644 tests/navigation/NavigationTests.tsx diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 1549486c1849..7fcf15b967ee 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -663,6 +663,7 @@ function isOnboardingFlow() { function isValidateLoginFlow() { const state = navigationRef.getRootState(); + console.log('state', state); const currentFocusedRoute = findFocusedRoute(state); return currentFocusedRoute?.name === SCREENS.VALIDATE_LOGIN; } diff --git a/tests/navigation/NavigationTests.tsx b/tests/navigation/NavigationTests.tsx new file mode 100644 index 000000000000..849f96146c4c --- /dev/null +++ b/tests/navigation/NavigationTests.tsx @@ -0,0 +1,43 @@ +import {render} from '@testing-library/react-native'; +import React from 'react'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import getIsNarrowLayout from '@libs/getIsNarrowLayout'; +import Navigation from '@libs/Navigation/Navigation'; +import CONST from '@src/CONST'; +import TestNavigationContainer from '../utils/TestNavigationContainer'; + +jest.mock('@hooks/useResponsiveLayout', () => jest.fn()); +jest.mock('@libs/getIsNarrowLayout', () => jest.fn()); + +jest.mock('@pages/home/sidebar/NavigationTabBarAvatar'); +jest.mock('@src/components/Navigation/TopLevelNavigationTabBar'); + +const mockedGetIsNarrowLayout = getIsNarrowLayout as jest.MockedFunction; +const mockedUseResponsiveLayout = useResponsiveLayout as jest.MockedFunction; + +describe('Navigation', () => { + beforeEach(() => { + mockedGetIsNarrowLayout.mockReturnValue(false); + mockedUseResponsiveLayout.mockReturnValue({...CONST.NAVIGATION_TESTS.DEFAULT_USE_RESPONSIVE_LAYOUT_VALUE, shouldUseNarrowLayout: false}); + }); + + describe('isValidateLoginFlow', () => { + it('should return true when the current focused route is the validate login screen', () => { + // Given the navigation state with the validate login screen + render( + , + ); + + expect(Navigation.isValidateLoginFlow()).toBe(true); + }); + }); +}); diff --git a/tests/utils/TestNavigationContainer.tsx b/tests/utils/TestNavigationContainer.tsx index 982e46f793fd..0c3370f12de0 100644 --- a/tests/utils/TestNavigationContainer.tsx +++ b/tests/utils/TestNavigationContainer.tsx @@ -145,6 +145,10 @@ function TestNavigationContainer({initialState}: TestNavigationContainerProps) { name={NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR} component={TestSearchFullscreenNavigator} /> + ); From 634a1b7c11e245c5a00d5c28119ae71e792ed967 Mon Sep 17 00:00:00 2001 From: paulnjs Date: Tue, 28 Oct 2025 13:43:48 +0700 Subject: [PATCH 3/3] remove log --- src/libs/Navigation/Navigation.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 7fcf15b967ee..1549486c1849 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -663,7 +663,6 @@ function isOnboardingFlow() { function isValidateLoginFlow() { const state = navigationRef.getRootState(); - console.log('state', state); const currentFocusedRoute = findFocusedRoute(state); return currentFocusedRoute?.name === SCREENS.VALIDATE_LOGIN; }