Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictb committed Sep 23, 2024
1 parent 7411e83 commit cb27983
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Str} from 'expensify-common';
import React, {memo, useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {Animated, Keyboard, View} from 'react-native';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {withOnyx} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {useSharedValue} from 'react-native-reanimated';
import type {ValueOf} from 'type-fest';
Expand Down Expand Up @@ -49,11 +49,6 @@ import SafeAreaConsumer from './SafeAreaConsumer';
* to display a full size image or PDF modally with optional confirmation button.
*/

type AttachmentModalOnyxProps = {
/** The transaction associated with the receipt attachment, if any */
transaction: OnyxEntry<OnyxTypes.Transaction>;
};

type ImagePickerResponse = {
height?: number;
name: string;
Expand All @@ -70,7 +65,7 @@ type ChildrenProps = {
show: () => void;
};

type AttachmentModalProps = AttachmentModalOnyxProps & {
type AttachmentModalProps = {
/** Optional source (URL, SVG function) for the image shown. If not passed in via props must be specified when modal is opened. */
source?: AvatarSource;

Expand Down Expand Up @@ -154,7 +149,6 @@ function AttachmentModal({
isReceiptAttachment = false,
isWorkspaceAvatar = false,
maybeIcon = false,
transaction,
headerTitle,
children,
fallbackSource,
Expand Down Expand Up @@ -185,6 +179,9 @@ function AttachmentModal({
const nope = useSharedValue(false);
const isOverlayModalVisible = (isReceiptAttachment && isDeleteReceiptConfirmModalVisible) || (!isReceiptAttachment && isAttachmentInvalid);
const iouType = useMemo(() => (isTrackExpenseAction ? CONST.IOU.TYPE.TRACK : CONST.IOU.TYPE.SUBMIT), [isTrackExpenseAction]);
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1');
const transactionID = ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID ?? '-1' : '-1';
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`);

const [file, setFile] = useState<FileObject | undefined>(
originalFileName
Expand Down Expand Up @@ -642,14 +639,6 @@ function AttachmentModal({

AttachmentModal.displayName = 'AttachmentModal';

export default withOnyx<AttachmentModalProps, AttachmentModalOnyxProps>({
transaction: {
key: ({report}) => {
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '-1', report?.parentReportActionID ?? '-1');
const transactionID = ReportActionsUtils.isMoneyRequestAction(parentReportAction) ? ReportActionsUtils.getOriginalMessage(parentReportAction)?.IOUTransactionID ?? '-1' : '-1';
return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`;
},
},
})(memo(AttachmentModal));
export default memo(AttachmentModal);

export type {Attachment, FileObject, ImagePickerResponse};

0 comments on commit cb27983

Please sign in to comment.