Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import {navigationRef} from '@libs/Navigation/Navigation';
* @param allWideRHPKeys - an array of all Wide/Super Wide RHP keys
*/
function getVisibleWideRHPKeys(allWideRHPKeys: string[]) {
if (!navigationRef.isReady()) {
return [];
}

const rootState = navigationRef.getRootState();

if (!rootState) {
Expand Down
4 changes: 4 additions & 0 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ const closeRHPFlow = (ref = navigationRef) => originalCloseRHPFlow(ref);
* Returns the current active route.
*/
function getActiveRoute(): string {
if (!navigationRef.isReady()) {
return '';
}

const currentRoute = navigationRef.current && navigationRef.current.getCurrentRoute();
if (!currentRoute?.name) {
return '';
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/helpers/isRoutePreloaded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import navigationRef from '@libs/Navigation/navigationRef';
import type {AuthScreensParamList, NavigationPartialRoute} from '@libs/Navigation/types';

export default function isRoutePreloaded(routeName: keyof AuthScreensParamList) {
if (!navigationRef.isReady()) {
return false;
}
const rootState = navigationRef.getRootState() as NavigationState<AuthScreensParamList> & {preloadedRoutes: Array<NavigationPartialRoute<keyof AuthScreensParamList>>};
return rootState.preloadedRoutes.some((preloadedRoute) => preloadedRoute.name === routeName);
}
Loading