@@ -4,6 +4,7 @@ import {View} from 'react-native';
44import type { OnyxEntry } from 'react-native-onyx' ;
55import AttachmentPicker from '@components/AttachmentPicker' ;
66import { DelegateNoAccessContext } from '@components/DelegateNoAccessModalProvider' ;
7+ import { useFullScreenLoader } from '@components/FullScreenLoaderContext' ;
78import Icon from '@components/Icon' ;
89import * as Expensicons from '@components/Icon/Expensicons' ;
910import type { PopoverMenuItem } from '@components/PopoverMenu' ;
@@ -133,6 +134,7 @@ function AttachmentPickerWithMenuItems({
133134 const [ policy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID } ` , { canBeMissing : true } ) ;
134135 const { isProduction} = useEnvironment ( ) ;
135136 const { isBetaEnabled} = usePermissions ( ) ;
137+ const { setIsLoaderVisible} = useFullScreenLoader ( ) ;
136138
137139 const isManualDistanceTrackingEnabled = isBetaEnabled ( CONST . BETAS . MANUAL_DISTANCE ) ;
138140
@@ -314,6 +316,12 @@ function AttachmentPickerWithMenuItems({
314316 return (
315317 < AttachmentPicker
316318 allowMultiple = { isMultipleDragAndDropEnabled }
319+ onOpenPicker = { ( ) => {
320+ if ( ! isMultipleDragAndDropEnabled ) {
321+ return ;
322+ }
323+ setIsLoaderVisible ( true ) ;
324+ } }
317325 fileLimit = { isMultipleDragAndDropEnabled ? CONST . API_ATTACHMENT_VALIDATIONS . MAX_FILE_LIMIT : 1 }
318326 shouldValidateImage = { ! isMultipleDragAndDropEnabled }
319327 >
@@ -322,7 +330,11 @@ function AttachmentPickerWithMenuItems({
322330 onTriggerAttachmentPicker ( ) ;
323331 openPicker ( {
324332 onPicked : ( data ) => displayFilesInModal ( data ) ,
325- onCanceled : onCanceledAttachmentPicker ,
333+ onCanceled : ( ) => {
334+ onCanceledAttachmentPicker ?.( ) ;
335+ setIsLoaderVisible ( false ) ;
336+ } ,
337+ onClosed : ( ) => setIsLoaderVisible ( false ) ,
326338 } ) ;
327339 } ;
328340 const menuItems = [
@@ -445,7 +457,10 @@ function AttachmentPickerWithMenuItems({
445457 }
446458 } }
447459 anchorPosition = { styles . createMenuPositionReportActionCompose ( shouldUseNarrowLayout , windowHeight , windowWidth ) }
448- anchorAlignment = { { horizontal : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . LEFT , vertical : CONST . MODAL . ANCHOR_ORIGIN_VERTICAL . BOTTOM } }
460+ anchorAlignment = { {
461+ horizontal : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . LEFT ,
462+ vertical : CONST . MODAL . ANCHOR_ORIGIN_VERTICAL . BOTTOM ,
463+ } }
449464 menuItems = { menuItems }
450465 anchorRef = { actionButtonRef }
451466 />
0 commit comments