@@ -63,6 +63,7 @@ function IOURequestStepScan({
63
63
physicalDevices : [ 'wide-angle-camera' , 'ultra-wide-angle-camera' ] ,
64
64
} ) ;
65
65
66
+ const isEditing = action === CONST . IOU . ACTION . EDIT ;
66
67
const hasFlash = ! ! device ?. hasFlash ;
67
68
const camera = useRef < Camera > ( null ) ;
68
69
const [ flash , setFlash ] = useState ( false ) ;
@@ -411,9 +412,9 @@ function IOURequestStepScan({
411
412
// Store the receipt on the transaction object in Onyx
412
413
// On Android devices, fetching blob for a file with name containing spaces fails to retrieve the type of file.
413
414
// So, let us also save the file type in receipt for later use during blob fetch
414
- IOU . setMoneyRequestReceipt ( transactionID , file ?. uri ?? '' , file . name ?? '' , action !== CONST . IOU . ACTION . EDIT , file . type ) ;
415
+ IOU . setMoneyRequestReceipt ( transactionID , file ?. uri ?? '' , file . name ?? '' , ! isEditing , file . type ) ;
415
416
416
- if ( action === CONST . IOU . ACTION . EDIT ) {
417
+ if ( isEditing ) {
417
418
updateScanAndNavigate ( file , file ?. uri ?? '' ) ;
418
419
return ;
419
420
}
@@ -448,10 +449,10 @@ function IOURequestStepScan({
448
449
. then ( ( photo : PhotoFile ) => {
449
450
// Store the receipt on the transaction object in Onyx
450
451
const source = getPhotoSource ( photo . path ) ;
451
- IOU . setMoneyRequestReceipt ( transactionID , source , photo . path , action !== CONST . IOU . ACTION . EDIT ) ;
452
+ IOU . setMoneyRequestReceipt ( transactionID , source , photo . path , ! isEditing ) ;
452
453
453
454
FileUtils . readFileAsync ( source , photo . path , ( file ) => {
454
- if ( action === CONST . IOU . ACTION . EDIT ) {
455
+ if ( isEditing ) {
455
456
updateScanAndNavigate ( file , source ) ;
456
457
return ;
457
458
}
@@ -464,7 +465,7 @@ function IOURequestStepScan({
464
465
showCameraAlert ( ) ;
465
466
Log . warn ( 'Error taking photo' , error ) ;
466
467
} ) ;
467
- } , [ cameraPermissionStatus , didCapturePhoto , flash , hasFlash , user ?. isMutedAllSounds , translate , transactionID , action , navigateToConfirmationStep , updateScanAndNavigate ] ) ;
468
+ } , [ isEditing , cameraPermissionStatus , didCapturePhoto , flash , hasFlash , user ?. isMutedAllSounds , translate , transactionID , navigateToConfirmationStep , updateScanAndNavigate ] ) ;
468
469
469
470
// Wait for camera permission status to render
470
471
if ( cameraPermissionStatus == null ) {
@@ -476,7 +477,7 @@ function IOURequestStepScan({
476
477
includeSafeAreaPaddingBottom
477
478
headerTitle = { translate ( 'common.receipt' ) }
478
479
onBackButtonPress = { navigateBack }
479
- shouldShowWrapper = { ! ! backTo }
480
+ shouldShowWrapper = { ! ! backTo || isEditing }
480
481
testID = { IOURequestStepScan . displayName }
481
482
>
482
483
{ isLoadingReceipt && < FullScreenLoadingIndicator /> }
0 commit comments