Skip to content

Commit

Permalink
Expensify#3559 fix initial route after relogin
Browse files Browse the repository at this point in the history
  • Loading branch information
dklymenk committed Jun 17, 2021
1 parent 5394fc8 commit d322277
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/libs/Navigation/AppNavigator/MainDrawerNavigator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -41,8 +40,10 @@ const getInitialReportScreenParams = (reports) => {
};

const MainDrawerNavigator = (props) => {
// When there are no reports there's no point to render the empty navigator
if (_.size(props.reports) === 0) {
const initialParams = getInitialReportScreenParams(props.reports);

// Wait until reports are fetched and there is a reportID in initialParams
if (!initialParams.reportID) {
return <FullScreenLoadingIndicator visible />;
}

Expand All @@ -69,7 +70,7 @@ const MainDrawerNavigator = (props) => {
<Drawer.Screen
name={SCREENS.REPORT}
component={ReportScreen}
initialParams={getInitialReportScreenParams(props.reports)}
initialParams={initialParams}
/>
</Drawer.Navigator>
);
Expand Down

0 comments on commit d322277

Please sign in to comment.