Skip to content

Commit

Permalink
Merge pull request Expensify#53111 from nkdengineer/fix/52415
Browse files Browse the repository at this point in the history
fix: user lands on previous attachment
  • Loading branch information
srikarparsi authored Dec 11, 2024
2 parents f9ec4fa + cf78559 commit f8f12c2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/components/Attachments/AttachmentCarousel/Pager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ function AttachmentCarouselPager(
[activePageIndex, items],
);

const extractItemKey = useCallback(
(item: Attachment) => (typeof item.source === 'string' || typeof item.source === 'number' ? `source-${item.source}|${item.attachmentLink}` : `reportActionID-${item.reportActionID}`),
[],
);
const extractItemKey = useCallback((item: Attachment, index: number) => `reportActionID-${item.reportActionID}-${index}`, []);

const contextValue = useMemo(
() => ({
Expand Down Expand Up @@ -124,7 +121,7 @@ function AttachmentCarouselPager(

const carouselItems = items.map((item, index) => (
<View
key={extractItemKey(item)}
key={extractItemKey(item, index)}
style={styles.flex1}
>
<CarouselItem
Expand Down

0 comments on commit f8f12c2

Please sign in to comment.