@@ -17,6 +17,7 @@ import useNetwork from '@hooks/useNetwork';
1717import useOnyx from '@hooks/useOnyx' ;
1818import usePermissions from '@hooks/usePermissions' ;
1919import usePrevious from '@hooks/usePrevious' ;
20+ import useReportIsArchived from '@hooks/useReportIsArchived' ;
2021import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
2122import useTheme from '@hooks/useTheme' ;
2223import useThemeStyles from '@hooks/useThemeStyles' ;
@@ -42,7 +43,7 @@ import {
4243 shouldShowPolicy ,
4344} from '@libs/PolicyUtils' ;
4445import { getQuickActionIcon , getQuickActionTitle , isQuickActionAllowed } from '@libs/QuickActionUtils' ;
45- import { generateReportID , getDisplayNameForParticipant , getIcons , getReportName , getWorkspaceChats , isArchivedReport , isPolicyExpenseChat } from '@libs/ReportUtils' ;
46+ import { generateReportID , getDisplayNameForParticipant , getIcons , getReportName , getWorkspaceChats , isPolicyExpenseChat } from '@libs/ReportUtils' ;
4647import { shouldRestrictUserBillableActions } from '@libs/SubscriptionUtils' ;
4748import variables from '@styles/variables' ;
4849import { closeReactNativeApp } from '@userActions/HybridApp' ;
@@ -97,7 +98,6 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
9798 const [ session ] = useOnyx ( ONYXKEYS . SESSION , { canBeMissing : false , selector : ( onyxSession ) => ( { email : onyxSession ?. email , accountID : onyxSession ?. accountID } ) } ) ;
9899 const [ quickAction ] = useOnyx ( ONYXKEYS . NVP_QUICK_ACTION_GLOBAL_CREATE , { canBeMissing : true } ) ;
99100 const [ quickActionReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ quickAction ?. chatReportID } ` , { canBeMissing : true } ) ;
100- const [ reportNameValuePairs ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS } ${ quickActionReport ?. reportID } ` , { canBeMissing : true } ) ;
101101 const [ activePolicyID ] = useOnyx ( ONYXKEYS . NVP_ACTIVE_POLICY_ID , { canBeMissing : true } ) ;
102102 const [ allReports ] = useOnyx ( ONYXKEYS . COLLECTION . REPORT , { canBeMissing : true } ) ;
103103 const [ activePolicy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ activePolicyID } ` , { canBeMissing : true } ) ;
@@ -120,6 +120,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
120120 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
121121 const isFocused = useIsFocused ( ) ;
122122 const prevIsFocused = usePrevious ( isFocused ) ;
123+ const isReportArchived = useReportIsArchived ( quickActionReport ?. reportID ) ;
123124 const { isOffline} = useNetwork ( ) ;
124125 const { isBlockedFromSpotnanaTravel, isBetaEnabled} = usePermissions ( ) ;
125126 const isManualDistanceTrackingEnabled = isBetaEnabled ( CONST . BETAS . MANUAL_DISTANCE ) ;
@@ -128,7 +129,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
128129 const [ travelSettings ] = useOnyx ( ONYXKEYS . NVP_TRAVEL_SETTINGS , { canBeMissing : true } ) ;
129130
130131 const canSendInvoice = useMemo ( ( ) => canSendInvoicePolicyUtils ( allPolicies as OnyxCollection < OnyxTypes . Policy > , session ?. email ) , [ allPolicies , session ?. email ] ) ;
131- const isValidReport = ! ( isEmptyObject ( quickActionReport ) || isArchivedReport ( reportNameValuePairs ) ) ;
132+ const isValidReport = ! ( isEmptyObject ( quickActionReport ) || isReportArchived ) ;
132133 const [ introSelected ] = useOnyx ( ONYXKEYS . NVP_INTRO_SELECTED , { canBeMissing : true } ) ;
133134 const [ hasSeenTour = false ] = useOnyx ( ONYXKEYS . NVP_ONBOARDING , {
134135 selector : hasSeenTourSelector ,
@@ -327,7 +328,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
327328 } ;
328329
329330 if ( quickAction ?. action ) {
330- if ( ! isQuickActionAllowed ( quickAction , quickActionReport , quickActionPolicy ) ) {
331+ if ( ! isQuickActionAllowed ( quickAction , quickActionReport , quickActionPolicy , isReportArchived ) ) {
331332 return [ ] ;
332333 }
333334 const onSelected = ( ) => {
0 commit comments