Skip to content

Commit f9b88ee

Browse files
MelvinBotmkhutornyi
andcommitted
Normalize /Home path to lowercase in getAdaptedStateFromPath
React Navigation generates /Home (capitalized) for the sign-in page because PublicScreens uses SCREENS.HOME ('Home') at the root level without a path mapping. This causes a "not found" page when navigating to /Home after login. Normalize the path to lowercase when it case-insensitively matches /home, following the same pattern as the existing /signin normalization. Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
1 parent c491e7e commit f9b88ee

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/libs/Navigation/helpers/getAdaptedStateFromPath.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ const getAdaptedStateFromPath: GetAdaptedStateFromPath = (path, options, shouldR
411411
normalizedPath = '/';
412412
}
413413

414+
// React Navigation generates /Home (capitalized) for the sign-in page because PublicScreens uses SCREENS.HOME ('Home')
415+
// at the root level without a path mapping. Normalize it to the correct lowercase route to avoid “not found” pages.
416+
if (normalizedPath.toLowerCase() === `/${ROUTES.HOME}`) {
417+
normalizedPath = `/${ROUTES.HOME}`;
418+
}
419+
414420
const state = getStateFromPath(normalizedPath as RoutePath) as PartialState<NavigationState<RootNavigatorParamList>>;
415421
if (shouldReplacePathInNestedState) {
416422
replacePathInNestedState(state, normalizedPath);

0 commit comments

Comments
 (0)