Skip to content

Commit

Permalink
use const
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Apr 17, 2024
1 parent 5acf31c commit 671039d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libs/Navigation/getTopmostBottomTabRoute.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import NAVIGATORS from '@src/NAVIGATORS';
import type {BottomTabName, NavigationPartialRoute, RootStackParamList, State} from './types';

function getTopmostBottomTabRoute(state: State<RootStackParamList> | undefined): NavigationPartialRoute<BottomTabName> | undefined {
const bottomTabNavigatorRoute = state?.routes.findLast((route) => route.name === 'BottomTabNavigator');
const bottomTabNavigatorRoute = state?.routes.findLast((route) => route.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR);

// The bottomTabNavigatorRoute state may be empty if we just logged in.
if (!bottomTabNavigatorRoute || bottomTabNavigatorRoute.name !== 'BottomTabNavigator' || bottomTabNavigatorRoute.state === undefined) {
if (!bottomTabNavigatorRoute || bottomTabNavigatorRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR || bottomTabNavigatorRoute.state === undefined) {
return undefined;
}

Expand Down

0 comments on commit 671039d

Please sign in to comment.