From 11cabd11c80f3c7167bd2362786ed9e4a7a832aa Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Fri, 13 Oct 2023 06:06:06 +0530 Subject: [PATCH 1/4] fixes: invalid file modal and delete option shown for setted IOU --- src/components/AttachmentModal.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index b8bfb4c36122..e1488037a0d1 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -376,7 +376,7 @@ function AttachmentModal(props) { text: props.translate('common.download'), onSelected: () => downloadAttachment(source), }); - if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction)) { + if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction)&& !isSettled) { menuItems.push({ icon: Expensicons.Trashcan, text: props.translate('receipt.deleteReceipt'), @@ -469,7 +469,7 @@ function AttachmentModal(props) { )} )} - {isAttachmentReceipt ? ( + {isAttachmentReceipt && ( - ) : ( - )} + {props.children && props.children({ From 1cef1db8bf34c7240d68f0ef32fa02a84f92b9d9 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Fri, 13 Oct 2023 06:20:02 +0530 Subject: [PATCH 2/4] Update src/components/AttachmentModal.js Co-authored-by: Jasper Huang --- src/components/AttachmentModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index e1488037a0d1..12f076086eed 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -376,7 +376,7 @@ function AttachmentModal(props) { text: props.translate('common.download'), onSelected: () => downloadAttachment(source), }); - if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction)&& !isSettled) { + if (TransactionUtils.hasReceipt(props.transaction) && !TransactionUtils.isReceiptBeingScanned(props.transaction) && !isSettled) { menuItems.push({ icon: Expensicons.Trashcan, text: props.translate('receipt.deleteReceipt'), From 1f8f484575e398b7d06a607e4013e829925772cc Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Fri, 13 Oct 2023 06:51:30 +0530 Subject: [PATCH 3/4] added conditon back for only render invalid modal when attachment is not receipt --- src/components/AttachmentModal.js | 60 ++++++++++++++++--------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 12f076086eed..6eb0b5de2fc1 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -1,11 +1,11 @@ -import React, {useState, useCallback, useRef, useMemo} from 'react'; +import React, { useState, useCallback, useRef, useMemo } from 'react'; import PropTypes from 'prop-types'; -import {View, Animated, Keyboard} from 'react-native'; +import { View, Animated, Keyboard } from 'react-native'; import Str from 'expensify-common/lib/str'; import lodashGet from 'lodash/get'; import lodashExtend from 'lodash/extend'; import _ from 'underscore'; -import {withOnyx} from 'react-native-onyx'; +import { withOnyx } from 'react-native-onyx'; import CONST from '../CONST'; import Modal from './Modal'; import AttachmentView from './Attachments/AttachmentView'; @@ -16,11 +16,11 @@ import * as StyleUtils from '../styles/StyleUtils'; import * as FileUtils from '../libs/fileDownload/FileUtils'; import themeColors from '../styles/themes/default'; import compose from '../libs/compose'; -import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions'; +import withWindowDimensions, { windowDimensionsPropTypes } from './withWindowDimensions'; import Button from './Button'; import HeaderWithBackButton from './HeaderWithBackButton'; import fileDownload from '../libs/fileDownload'; -import withLocalize, {withLocalizePropTypes} from './withLocalize'; +import withLocalize, { withLocalizePropTypes } from './withLocalize'; import ConfirmModal from './ConfirmModal'; import HeaderGap from './HeaderGap'; import SafeAreaConsumer from './SafeAreaConsumer'; @@ -104,9 +104,9 @@ const defaultProps = { headerTitle: null, report: {}, transaction: {}, - onModalShow: () => {}, - onModalHide: () => {}, - onCarouselAttachmentChange: () => {}, + onModalShow: () => { }, + onModalHide: () => { }, + onCarouselAttachmentChange: () => { }, isWorkspaceAvatar: false, }; @@ -125,17 +125,17 @@ function AttachmentModal(props) { const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false); const [confirmButtonFadeAnimation] = useState(new Animated.Value(1)); const [shouldShowDownloadButton, setShouldShowDownloadButton] = React.useState(true); - const {windowWidth} = useWindowDimensions(); + const { windowWidth } = useWindowDimensions(); const [file, setFile] = useState( props.originalFileName ? { - name: props.originalFileName, - } + name: props.originalFileName, + } : undefined, ); - const {translate} = useLocalize(); - const {isOffline} = useNetwork(); + const { translate } = useLocalize(); + const { isOffline } = useNetwork(); const onCarouselAttachmentChange = props.onCarouselAttachmentChange; @@ -205,7 +205,7 @@ function AttachmentModal(props) { } if (props.onConfirm) { - props.onConfirm(lodashExtend(file, {source})); + props.onConfirm(lodashExtend(file, { source })); } setIsModalOpen(false); @@ -292,7 +292,7 @@ function AttachmentModal(props) { let updatedFile = fileObject; const cleanName = FileUtils.cleanFileName(updatedFile.name); if (updatedFile.name !== cleanName) { - updatedFile = new File([updatedFile], cleanName, {type: updatedFile.type}); + updatedFile = new File([updatedFile], cleanName, { type: updatedFile.type }); } const inputSource = URL.createObjectURL(updatedFile); const inputModalType = getModalType(inputSource, updatedFile); @@ -454,7 +454,7 @@ function AttachmentModal(props) { {/* If we have an onConfirm method show a confirmation button */} {Boolean(props.onConfirm) && ( - {({safeAreaPaddingBottomStyle}) => ( + {({ safeAreaPaddingBottomStyle }) => (