@@ -16,10 +16,10 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback';
16
16
import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView' ;
17
17
import ScreenWrapper from '@components/ScreenWrapper' ;
18
18
import TaskHeaderActionButton from '@components/TaskHeaderActionButton' ;
19
- import type { CurrentReportIDContextValue } from '@components/withCurrentReportID' ;
20
- import withCurrentReportID from '@components/withCurrentReportID' ;
21
19
import useActiveWorkspace from '@hooks/useActiveWorkspace' ;
22
20
import useAppFocusEvent from '@hooks/useAppFocusEvent' ;
21
+ import type { CurrentReportIDContextValue } from '@hooks/useCurrentReportID' ;
22
+ import useCurrentReportID from '@hooks/useCurrentReportID' ;
23
23
import useDeepCompareRef from '@hooks/useDeepCompareRef' ;
24
24
import useLocalize from '@hooks/useLocalize' ;
25
25
import useNetwork from '@hooks/useNetwork' ;
@@ -97,7 +97,7 @@ function getParentReportAction(parentReportActions: OnyxEntry<OnyxTypes.ReportAc
97
97
return parentReportActions [ parentReportActionID ?? '0' ] ;
98
98
}
99
99
100
- function ReportScreen ( { route, currentReportID = '' , navigation} : ReportScreenProps ) {
100
+ function ReportScreen ( { route, navigation} : ReportScreenProps ) {
101
101
const styles = useThemeStyles ( ) ;
102
102
const { translate} = useLocalize ( ) ;
103
103
const reportIDFromRoute = getReportID ( route ) ;
@@ -112,6 +112,7 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
112
112
const { isOffline} = useNetwork ( ) ;
113
113
const { shouldUseNarrowLayout, isInNarrowPaneModal} = useResponsiveLayout ( ) ;
114
114
const { activeWorkspaceID} = useActiveWorkspace ( ) ;
115
+ const currentReportIDValue = useCurrentReportID ( ) ;
115
116
116
117
const [ modal ] = useOnyx ( ONYXKEYS . MODAL ) ;
117
118
const [ isComposerFullSize ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_IS_COMPOSER_FULL_SIZE } ${ reportIDFromRoute } ` , { initialValue : false } ) ;
@@ -277,7 +278,7 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
277
278
const lastReportAction = [ ...combinedReportActions , parentReportAction ] . find ( ( action ) => ReportUtils . canEditReportAction ( action ) && ! ReportActionsUtils . isMoneyRequestAction ( action ) ) ;
278
279
const isSingleTransactionView = ReportUtils . isMoneyRequest ( report ) || ReportUtils . isTrackExpenseReport ( report ) ;
279
280
const policy = policies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID ?? '-1' } ` ] ;
280
- const isTopMostReportId = currentReportID === reportIDFromRoute ;
281
+ const isTopMostReportId = currentReportIDValue ?. currentReportID === reportIDFromRoute ;
281
282
const didSubscribeToReportLeavingEvents = useRef ( false ) ;
282
283
const [ showSoftInputOnFocus , setShowSoftInputOnFocus ] = useState ( false ) ;
283
284
@@ -870,4 +871,4 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
870
871
}
871
872
872
873
ReportScreen . displayName = 'ReportScreen' ;
873
- export default withCurrentReportID ( memo ( ReportScreen , ( prevProps , nextProps ) => prevProps . currentReportID === nextProps . currentReportID && lodashIsEqual ( prevProps . route , nextProps . route ) ) ) ;
874
+ export default memo ( ReportScreen , ( prevProps , nextProps ) => lodashIsEqual ( prevProps . route , nextProps . route ) ) ;
0 commit comments