Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS migration] Migrate 'ReportActionItemReportPreview.js' component to TypeScript #34374

Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
96ab013
[TS migration] Migrate 'ReportActionItemReportPreview.js' component
VickyStash Jan 11, 2024
273406e
Reuse PaymentMethodType in other places
VickyStash Jan 12, 2024
cdd6480
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 15, 2024
ef8050c
Remove extra double negation, fix lint error
VickyStash Jan 15, 2024
a40a0ee
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 16, 2024
449e691
TS fixes after merging main
VickyStash Jan 16, 2024
fdb6a9a
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 17, 2024
23c94b6
Use ContextMenuAnchor type for anchor typing
VickyStash Jan 17, 2024
b2ca9a6
Fix lint error
VickyStash Jan 17, 2024
a53da9d
Fix lint error in import
VickyStash Jan 17, 2024
d24481a
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 18, 2024
ed8e47e
Fix ts error
VickyStash Jan 18, 2024
a0eb3c7
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 19, 2024
2ccf45f
Update TransactionViolations type
VickyStash Jan 19, 2024
48ccf59
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 22, 2024
7910c46
TS fixes after merging main
VickyStash Jan 22, 2024
1e4952b
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 23, 2024
0110446
Fix TS issue
VickyStash Jan 23, 2024
ed0c95d
Update image typing
VickyStash Jan 23, 2024
4fcb65b
Fix lint error
VickyStash Jan 23, 2024
033aaa1
Fix lint error
VickyStash Jan 23, 2024
2189e2f
Reuse ContextMenuAnchor type, use TranslationPaths type
VickyStash Jan 23, 2024
6b5e775
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 24, 2024
e98645f
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 26, 2024
1a7767b
Merge branch 'main' into ts-migration/reportActionItemReportPreview-c…
VickyStash Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/ImageWithSizeCalculation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import delay from 'lodash/delay';
import React, {useEffect, useRef, useState} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import type {ImageSourcePropType, StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import useThemeStyles from '@hooks/useThemeStyles';
import Log from '@libs/Log';
Expand All @@ -19,7 +19,7 @@ type OnLoadNativeEvent = {

type ImageWithSizeCalculationProps = {
/** Url for image to display */
url: string | number;
url: string | ImageSourcePropType;

/** Any additional styles to apply */
style?: StyleProp<ViewStyle>;
Expand Down
5 changes: 3 additions & 2 deletions src/components/ReportActionItem/ReportActionItemImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Str from 'expensify-common/lib/str';
import React from 'react';
import type {ReactElement} from 'react';
import {View} from 'react-native';
import type {ImageSourcePropType} from 'react-native';
import AttachmentModal from '@components/AttachmentModal';
import EReceiptThumbnail from '@components/EReceiptThumbnail';
import Image from '@components/Image';
Expand All @@ -17,10 +18,10 @@ import type {Transaction} from '@src/types/onyx';

type ReportActionItemImageProps = {
/** thumbnail URI for the image */
thumbnail?: string | number;
thumbnail?: string | ImageSourcePropType | null;

/** URI for the image or local numeric reference for the image */
image: string | number;
image: string | ImageSourcePropType;

/** whether or not to enable the image preview modal */
enablePreviewModal?: boolean;
Expand Down
13 changes: 3 additions & 10 deletions src/components/ReportActionItem/ReportActionItemImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@ import Text from '@components/Text';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import type {ThumbnailAndImageURI} from '@libs/ReceiptUtils';
import variables from '@styles/variables';
import type {Transaction} from '@src/types/onyx';
import ReportActionItemImage from './ReportActionItemImage';

type Image = {
thumbnail: string | number;
image: string | number;
transaction: Transaction;
isLocalFile: boolean;
};

type ReportActionItemImagesProps = {
/** array of image and thumbnail URIs */
images: Image[];
images: ThumbnailAndImageURI[];

// We're not providing default values for size and total and disabling the ESLint rule
// because we want them to default to the length of images, but we can't set default props
Expand Down Expand Up @@ -79,7 +72,7 @@ function ReportActionItemImages({images, size, total, isHovered = false}: Report
const borderStyle = shouldShowBorder ? styles.reportActionItemImageBorder : {};
return (
<View
key={`${index}-${image}`}
key={`${index}-${image as string}`}
style={[styles.reportActionItemImage, borderStyle, hoverStyle]}
>
<ReportActionItemImage
Expand Down
Loading
Loading