Skip to content

Commit

Permalink
Add withCurrentReportIDPropTypes and use the prop currentReportID ins…
Browse files Browse the repository at this point in the history
…tead of calling getTopmostReportId

Signed-off-by: Pierre Michel <[email protected]>
  • Loading branch information
ShogunFire committed Aug 31, 2023
1 parent 819a769 commit 0665ea0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import ReportScreenContext from './ReportScreenContext';
import TaskHeaderActionButton from '../../components/TaskHeaderActionButton';
import DragAndDropProvider from '../../components/DragAndDrop/Provider';
import usePrevious from '../../hooks/usePrevious';
import withCurrentReportID from '../../components/withCurrentReportID';
import withCurrentReportID, {withCurrentReportIDPropTypes, withCurrentReportIDDefaultProps} from '../../components/withCurrentReportID';

const propTypes = {
/** Navigation route context info provided by react navigation */
Expand Down Expand Up @@ -89,6 +89,7 @@ const propTypes = {

...windowDimensionsPropTypes,
...viewportOffsetTopPropTypes,
...withCurrentReportIDPropTypes,
};

const defaultProps = {
Expand All @@ -103,6 +104,7 @@ const defaultProps = {
policies: {},
accountManagerReportID: null,
personalDetails: {},
...withCurrentReportIDDefaultProps,
};

/**
Expand Down Expand Up @@ -132,6 +134,7 @@ function ReportScreen({
viewportOffsetTop,
isComposerFullSize,
errors,
currentReportID,
}) {
const firstRenderRef = useRef(true);
const flatListRef = useRef();
Expand All @@ -158,7 +161,7 @@ function ReportScreen({

const policy = policies[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];

const isTopMostReportId = Navigation.getTopmostReportId() === getReportID(route);
const isTopMostReportId = currentReportID === getReportID(route);

let headerView = (
<HeaderView
Expand Down

0 comments on commit 0665ea0

Please sign in to comment.