Skip to content

Commit

Permalink
Merge pull request #33370 from dukenv0307/fix/33001
Browse files Browse the repository at this point in the history
Add logic in get active route
  • Loading branch information
dangrous authored Jan 2, 2024
2 parents b8b675d + 7163807 commit 5b02cf0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ function getActiveRoute(): string {
return '';
}

if (currentRoute?.path) {
return currentRoute.path;
}

const routeFromState = getPathFromState(navigationRef.getRootState(), linkingConfig.config);

if (routeFromState) {
Expand All @@ -114,8 +118,10 @@ function getActiveRoute(): string {
* @return is active
*/
function isActiveRoute(routePath: Route): boolean {
// We remove First forward slash from the URL before matching
return getActiveRoute().substring(1) === routePath;
let activeRoute = getActiveRoute();
activeRoute = activeRoute.startsWith('/') ? activeRoute.substring(1) : activeRoute;

return activeRoute === routePath;
}

/**
Expand Down

0 comments on commit 5b02cf0

Please sign in to comment.