diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index e88f6cd0b756..5b1a7f897c3e 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -1,6 +1,6 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; -import React from 'react'; +import React, {memo} from 'react'; import {View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; @@ -271,21 +271,23 @@ HeaderView.propTypes = propTypes; HeaderView.displayName = 'HeaderView'; HeaderView.defaultProps = defaultProps; -export default compose( - withWindowDimensions, - withLocalize, - withOnyx({ - guideCalendarLink: { - key: ONYXKEYS.ACCOUNT, - selector: (account) => (account && account.guideCalendarLink) || null, - initialValue: null, - }, - parentReport: { - key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID || report.reportID}`, - selector: reportWithoutHasDraftSelector, - }, - session: { - key: ONYXKEYS.SESSION, - }, - }), -)(HeaderView); +export default memo( + compose( + withWindowDimensions, + withLocalize, + withOnyx({ + guideCalendarLink: { + key: ONYXKEYS.ACCOUNT, + selector: (account) => (account && account.guideCalendarLink) || null, + initialValue: null, + }, + parentReport: { + key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID || report.reportID}`, + selector: reportWithoutHasDraftSelector, + }, + session: { + key: ONYXKEYS.SESSION, + }, + }), + )(HeaderView), +); diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 1b6dd9186453..f7ab1767aade 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -182,10 +182,14 @@ function ReportScreen({ const isTopMostReportId = currentReportID === getReportID(route); const didSubscribeToReportLeavingEvents = useRef(false); + const goBack = useCallback(() => { + Navigation.goBack(ROUTES.HOME, false, true); + }, []); + let headerView = ( Navigation.goBack(ROUTES.HOME, false, true)} + onNavigationMenuButtonClicked={goBack} personalDetails={personalDetails} report={report} />