@@ -30,6 +30,7 @@ import useOnyx from '@hooks/useOnyx';
3030import usePaginatedReportActions from '@hooks/usePaginatedReportActions' ;
3131import usePermissions from '@hooks/usePermissions' ;
3232import useReportIsArchived from '@hooks/useReportIsArchived' ;
33+ import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
3334import useThemeStyles from '@hooks/useThemeStyles' ;
3435import getBase62ReportID from '@libs/getBase62ReportID' ;
3536import Navigation from '@libs/Navigation/Navigation' ;
@@ -161,6 +162,8 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
161162 const { removeTransaction} = useSearchContext ( ) ;
162163
163164 const transactionThreadReportID = useMemo ( ( ) => getOneTransactionThreadReportID ( report , chatReport , reportActions ?? [ ] , isOffline ) , [ reportActions , isOffline , report , chatReport ] ) ;
165+ // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
166+ const { isSmallScreenWidth} = useResponsiveLayout ( ) ;
164167
165168 /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
166169 const [ transactionThreadReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ transactionThreadReportID } ` , { canBeMissing : true } ) ;
@@ -472,7 +475,11 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
472475 if ( ! report ?. policyID ) {
473476 return ;
474477 }
475- Navigation . navigate ( ROUTES . WORKSPACE_INITIAL . getRoute ( report ?. policyID , Navigation . getActiveRoute ( ) ) ) ;
478+ if ( isSmallScreenWidth ) {
479+ Navigation . navigate ( ROUTES . WORKSPACE_INITIAL . getRoute ( report ?. policyID , Navigation . getActiveRoute ( ) ) ) ;
480+ } else {
481+ Navigation . navigate ( ROUTES . WORKSPACE_OVERVIEW . getRoute ( report ?. policyID ) ) ;
482+ }
476483 } ,
477484 isAnonymousAction : false ,
478485 shouldShowRightIcon : true ,
@@ -541,6 +548,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
541548 isTaskActionable ,
542549 isRootGroupChat ,
543550 leaveChat ,
551+ isSmallScreenWidth ,
544552 ] ) ;
545553
546554 const displayNamesWithTooltips = useMemo ( ( ) => {
0 commit comments