@@ -325,6 +325,7 @@ function MoneyRequestConfirmationList({
325
325
const [ didConfirmSplit , setDidConfirmSplit ] = useState ( false ) ;
326
326
327
327
const [ isAttachmentInvalid , setIsAttachmentInvalid ] = useState ( false ) ;
328
+ const [ invalidAttachmentPromt , setInvalidAttachmentPromt ] = useState ( translate ( 'attachmentPicker.protectedPDFNotSupported' ) ) ;
328
329
329
330
const navigateBack = useCallback (
330
331
( ) => Navigation . goBack ( ROUTES . MONEY_REQUEST_CREATE_TAB_SCAN . getRoute ( CONST . IOU . ACTION . CREATE , iouType , transactionID , reportID ) ) ,
@@ -1096,7 +1097,14 @@ function MoneyRequestConfirmationList({
1096
1097
previewSourceURL = { resolvedReceiptImage as string }
1097
1098
// We don't support scanning password protected PDF receipt
1098
1099
enabled = { ! isAttachmentInvalid }
1099
- onPassword = { ( ) => setIsAttachmentInvalid ( true ) }
1100
+ onPassword = { ( ) => {
1101
+ setIsAttachmentInvalid ( true ) ;
1102
+ setInvalidAttachmentPromt ( translate ( 'attachmentPicker.protectedPDFNotSupported' ) ) ;
1103
+ } }
1104
+ onLoadError = { ( ) => {
1105
+ setInvalidAttachmentPromt ( translate ( 'attachmentPicker.errorWhileSelectingCorruptedAttachment' ) ) ;
1106
+ setIsAttachmentInvalid ( true ) ;
1107
+ } }
1100
1108
/>
1101
1109
) : (
1102
1110
< ReceiptImage
@@ -1125,6 +1133,7 @@ function MoneyRequestConfirmationList({
1125
1133
receiptThumbnail ,
1126
1134
fileExtension ,
1127
1135
isDistanceRequest ,
1136
+ translate ,
1128
1137
] ,
1129
1138
) ;
1130
1139
@@ -1181,11 +1190,11 @@ function MoneyRequestConfirmationList({
1181
1190
) }
1182
1191
< View style = { [ styles . mb5 ] } > { shouldShowAllFields && supplementaryFields } </ View >
1183
1192
< ConfirmModal
1184
- title = { translate ( 'attachmentPicker.wrongFileType ' ) }
1193
+ title = { translate ( 'attachmentPicker.attachmentError ' ) }
1185
1194
onConfirm = { navigateBack }
1186
1195
onCancel = { navigateBack }
1187
1196
isVisible = { isAttachmentInvalid }
1188
- prompt = { translate ( 'attachmentPicker.protectedPDFNotSupported' ) }
1197
+ prompt = { invalidAttachmentPromt }
1189
1198
confirmText = { translate ( 'common.close' ) }
1190
1199
shouldShowCancelButton = { false }
1191
1200
/>
@@ -1220,6 +1229,7 @@ function MoneyRequestConfirmationList({
1220
1229
transaction ,
1221
1230
transactionID ,
1222
1231
translate ,
1232
+ invalidAttachmentPromt ,
1223
1233
] ,
1224
1234
) ;
1225
1235
0 commit comments