Skip to content

Commit

Permalink
fix: remove useMemo
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Feb 14, 2024
1 parent d738e43 commit cfc6174
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions src/components/Attachments/AttachmentCarousel/Pager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,20 @@ function AttachmentCarouselPager({items, activeSource, initialPage, onPageSelect
[],
);

const carouselItems = useMemo(
() =>
items.map((item, index) => (
<View
key={item.source}
style={styles.flex1}
>
<CarouselItem
// @ts-expect-error TODO: Remove this once AttachmentView (https://github.com/Expensify/App/issues/25150) is migrated to TypeScript.
item={item}
isSingleItem={items.length === 1}
index={index}
isFocused={index === activePageIndex && activeSource === item.source}
/>
</View>
)),
[activePageIndex, activeSource, items, styles.flex1],
);
const carouselItems = items.map((item, index) => (
<View
key={item.source}
style={styles.flex1}
>
<CarouselItem
// @ts-expect-error TODO: Remove this once AttachmentView (https://github.com/Expensify/App/issues/25150) is migrated to TypeScript.
item={item}
isSingleItem={items.length === 1}
index={index}
isFocused={index === activePageIndex && activeSource === item.source}
/>
</View>
));

return (
<AttachmentCarouselPagerContext.Provider value={contextValue}>
Expand Down

0 comments on commit cfc6174

Please sign in to comment.