Skip to content

Commit

Permalink
Merge pull request #52534 from daledah/fix/52260
Browse files Browse the repository at this point in the history
fix: prevent open search on onboarding route
  • Loading branch information
stitesExpensify authored Nov 19, 2024
2 parents 9084293 + 16a3515 commit 812ccd7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {findFocusedRoute} from '@react-navigation/native';
import React, {memo, useEffect, useMemo, useRef, useState} from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
Expand All @@ -22,9 +23,10 @@ import KeyboardShortcut from '@libs/KeyboardShortcut';
import Log from '@libs/Log';
import getCurrentUrl from '@libs/Navigation/currentUrl';
import getOnboardingModalScreenOptions from '@libs/Navigation/getOnboardingModalScreenOptions';
import Navigation from '@libs/Navigation/Navigation';
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';
import shouldOpenOnAdminRoom from '@libs/Navigation/shouldOpenOnAdminRoom';
import type {AuthScreensParamList, CentralPaneName, CentralPaneScreensParamList} from '@libs/Navigation/types';
import {isOnboardingFlowName} from '@libs/NavigationUtils';
import NetworkConnection from '@libs/NetworkConnection';
import onyxSubscribe from '@libs/onyxSubscribe';
import * as Pusher from '@libs/Pusher/pusher';
Expand Down Expand Up @@ -348,6 +350,11 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
searchShortcutConfig.shortcutKey,
() => {
Session.checkIfActionIsAllowed(() => {
const state = navigationRef.getRootState();
const currentFocusedRoute = findFocusedRoute(state);
if (isOnboardingFlowName(currentFocusedRoute?.name)) {
return;
}
toggleSearchRouter();
})();
},
Expand Down

0 comments on commit 812ccd7

Please sign in to comment.