diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 823c3c15c36a..5be6c8ce835e 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -95,7 +95,6 @@ const reportAttributesSelector = (c: OnyxEntry) => function MoneyRequestReportPreviewContent({ iouReportID, - newTransactionIDs, chatReportID, action, containerStyles, @@ -441,33 +440,6 @@ function MoneyRequestReportPreviewContent({ const viewabilityConfig = useMemo(() => { return {itemVisiblePercentThreshold: 100}; }, []); - const numberOfScrollToIndexFailed = useRef(0); - const onScrollToIndexFailed: (info: {index: number; highestMeasuredFrameIndex: number; averageItemLength: number}) => void = ({index}) => { - // There is a probability of infinite loop so we want to make sure that it is not called more than 5 times. - if (numberOfScrollToIndexFailed.current > 4) { - return; - } - - // Sometimes scrollToIndex might be called before the item is rendered so we will re-call scrollToIndex after a small delay. - setTimeout(() => { - carouselRef.current?.scrollToIndex({index, animated: true, viewOffset: 2 * styles.gap2.gap}); - }, 100); - numberOfScrollToIndexFailed.current++; - }; - - useEffect(() => { - const index = carouselTransactions.findIndex((transaction) => newTransactionIDs?.includes(transaction.transactionID)); - - if (index < 0) { - return; - } - setTimeout(() => { - numberOfScrollToIndexFailed.current = 0; - carouselRef.current?.scrollToIndex({index, viewOffset: 2 * styles.gap2.gap, animated: true}); - }, CONST.ANIMATED_TRANSITION); - - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [newTransactionIDs]); // eslint-disable-next-line react-compiler/react-compiler const onViewableItemsChanged = useRef(({viewableItems}: {viewableItems: ViewToken[]; changed: ViewToken[]}) => { @@ -835,7 +807,6 @@ function MoneyRequestReportPreviewContent({ ) : ( transaction.transactionID); const renderItem: ListRenderItem = ({item}) => ( ); return ( void; - - /** IDs of newly added transactions */ - newTransactionIDs?: string[]; }; export type {MoneyRequestReportPreviewContentProps, MoneyRequestReportPreviewProps, MoneyRequestReportPreviewStyleType}; diff --git a/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx b/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx index 81e71bdefebd..5f16f61fe2f2 100644 --- a/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx +++ b/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx @@ -1,7 +1,6 @@ import truncate from 'lodash/truncate'; import React, {useMemo} from 'react'; import {View} from 'react-native'; -import Animated from 'react-native-reanimated'; import Button from '@components/Button'; import Icon from '@components/Icon'; // eslint-disable-next-line no-restricted-imports @@ -12,7 +11,6 @@ import ReportActionItemImages from '@components/ReportActionItem/ReportActionIte import UserInfoCellsWithArrow from '@components/SelectionListWithSections/Search/UserInfoCellsWithArrow'; import Text from '@components/Text'; import TransactionPreviewSkeletonView from '@components/TransactionPreviewSkeletonView'; -import useAnimatedHighlightStyle from '@hooks/useAnimatedHighlightStyle'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useEnvironment from '@hooks/useEnvironment'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; @@ -64,7 +62,6 @@ function TransactionPreviewContent({ shouldShowPayerAndReceiver, navigateToReviewFields, isReviewDuplicateTransactionPage = false, - shouldHighlight = false, }: TransactionPreviewContentProps) { const icons = useMemoizedLazyExpensifyIcons(['Folder', 'Tag']); const theme = useTheme(); @@ -221,17 +218,10 @@ function TransactionPreviewContent({ const previewTextViewGap = (shouldShowCategoryOrTag || !shouldWrapDisplayAmount) && styles.gap2; const previewTextMargin = shouldShowIOUHeader && shouldShowMerchantOrDescription && !isBillSplit && !shouldShowCategoryOrTag && styles.mbn1; - const animatedHighlightStyle = useAnimatedHighlightStyle({ - shouldHighlight, - highlightColor: theme.messageHighlightBG, - backgroundColor: theme.cardBG, - shouldApplyOtherStyles: false, - }); - const transactionWrapperStyles = [styles.border, styles.moneyRequestPreviewBox, (isIOUSettled || isApproved) && isSettlementOrApprovalPartial && styles.offlineFeedbackPending]; return ( - + offlineWithFeedbackOnClose} @@ -242,7 +232,7 @@ function TransactionPreviewContent({ shouldDisableOpacity={isDeleted} shouldHideOnDelete={shouldHideOnDelete} > - + - + ); } diff --git a/src/components/ReportActionItem/TransactionPreview/index.tsx b/src/components/ReportActionItem/TransactionPreview/index.tsx index b0388743d37a..5a50a494d99a 100644 --- a/src/components/ReportActionItem/TransactionPreview/index.tsx +++ b/src/components/ReportActionItem/TransactionPreview/index.tsx @@ -41,7 +41,6 @@ function TransactionPreview(props: TransactionPreviewProps) { iouReportID, transactionID: transactionIDFromProps, onPreviewPressed, - shouldHighlight, reportPreviewAction, contextAction, } = props; @@ -131,7 +130,6 @@ function TransactionPreview(props: TransactionPreviewProps) { walletTermsErrors={walletTerms?.errors} routeName={route.name} isReviewDuplicateTransactionPage={isReviewDuplicateTransactionPage} - shouldHighlight={shouldHighlight} /> ); @@ -156,7 +154,6 @@ function TransactionPreview(props: TransactionPreviewProps) { walletTermsErrors={walletTerms?.errors} routeName={route.name} reportPreviewAction={reportPreviewAction} - shouldHighlight={shouldHighlight} isReviewDuplicateTransactionPage={isReviewDuplicateTransactionPage} /> ); diff --git a/src/components/ReportActionItem/TransactionPreview/types.ts b/src/components/ReportActionItem/TransactionPreview/types.ts index 2a94f8701261..886dcf25a185 100644 --- a/src/components/ReportActionItem/TransactionPreview/types.ts +++ b/src/components/ReportActionItem/TransactionPreview/types.ts @@ -72,9 +72,6 @@ type TransactionPreviewProps = { /** In case we want to override context menu action */ contextAction?: OnyxEntry; - - /** Whether the item should be highlighted */ - shouldHighlight?: boolean; }; type TransactionPreviewContentProps = { @@ -144,9 +141,6 @@ type TransactionPreviewContentProps = { /** Is this component used during duplicate review flow */ isReviewDuplicateTransactionPage?: boolean; - - /** Whether the item should be highlighted */ - shouldHighlight?: boolean; }; export type {TransactionPreviewContentProps, TransactionPreviewProps, TransactionPreviewStyleType}; diff --git a/src/hooks/useAnimatedHighlightStyle/index.ts b/src/hooks/useAnimatedHighlightStyle/index.ts index cbb744e164d9..45646ad9be03 100644 --- a/src/hooks/useAnimatedHighlightStyle/index.ts +++ b/src/hooks/useAnimatedHighlightStyle/index.ts @@ -33,9 +33,6 @@ type Props = { /** Whether the item should be highlighted */ shouldHighlight: boolean; - /** Whether it should return height and border radius styles */ - shouldApplyOtherStyles?: boolean; - /** The base backgroundColor used for the highlight animation, defaults to theme.appBG * @default theme.appBG */ @@ -66,7 +63,6 @@ export default function useAnimatedHighlightStyle({ height, highlightColor, backgroundColor, - shouldApplyOtherStyles = true, skipInitialFade = false, }: Props) { const [startHighlight, setStartHighlight] = useState(false); @@ -84,8 +80,9 @@ export default function useAnimatedHighlightStyle({ return { backgroundColor: interpolateColor(repeatableValue, [0, 1], [backgroundColor ?? theme.appBG, highlightColor ?? theme.border]), + height: height ? interpolate(nonRepeatableValue, [0, 1], [0, height]) : 'auto', opacity: interpolate(nonRepeatableValue, [0, 1], [0, 1]), - ...(shouldApplyOtherStyles && {height: height ? interpolate(nonRepeatableValue, [0, 1], [0, height]) : 'auto', borderRadius}), + borderRadius, }; }, [borderRadius, height, backgroundColor, highlightColor, theme.appBG, theme.border]); diff --git a/src/styles/index.ts b/src/styles/index.ts index 7dca9b652270..85b69b22fe60 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -4247,10 +4247,6 @@ const staticStyles = (theme: ThemeColors) => backgroundColor: theme.cardBG, }, - reportPreviewBoxHoverBorderColor: { - borderColor: theme.cardBG, - }, - reportContainerBorderRadius: { borderRadius: variables.componentBorderRadiusLarge, },