From effed053b8be1806620b5dcae8b6d35af2373565 Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Tue, 17 Nov 2026 16:59:50 +0530 Subject: [PATCH] revert(gallery): keep ContentMediaGallery identical to other modules --- .../content/media/ContentMediaGallery.tsx | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/src/features/content/media/ContentMediaGallery.tsx b/src/features/content/media/ContentMediaGallery.tsx index 847f13b..328e729 100644 --- a/src/features/content/media/ContentMediaGallery.tsx +++ b/src/features/content/media/ContentMediaGallery.tsx @@ -141,21 +141,6 @@ export function ContentMediaGallery({ media, title = "Visual Reference" }: Conte const [viewerIndex, setViewerIndex] = useState(null); const listRef = useRef>(null); - const MAX_VISIBLE_DOTS = 7; - const visibleDots = useMemo(() => { - if (items.length <= MAX_VISIBLE_DOTS) { - return items.map((item, index) => ({ item, index })); - } - const half = Math.floor(MAX_VISIBLE_DOTS / 2); - let start = Math.max(0, activeIndex - half); - let end = start + MAX_VISIBLE_DOTS; - if (end > items.length) { - end = items.length; - start = Math.max(0, end - MAX_VISIBLE_DOTS); - } - return items.slice(start, end).map((item, i) => ({ item, index: start + i })); - }, [items, activeIndex]); - if (!items.length) return null; const handleMomentumEnd = (event: NativeSyntheticEvent) => { @@ -205,18 +190,14 @@ export function ContentMediaGallery({ media, title = "Visual Reference" }: Conte {mediaLabel(items[activeIndex], activeIndex)} ) : null} - {items.length > 0 ? ( + {items.length > 1 ? ( - {visibleDots.map(({ item, index }) => ( + {items.map((item, index) => ( { setActiveIndex(index); - try { - listRef.current?.scrollToIndex({ index, animated: true }); - } catch { - listRef.current?.scrollToOffset({ offset: index * carouselWidth, animated: true }); - } + listRef.current?.scrollToIndex({ index, animated: true }); }} hitSlop={6} > @@ -273,12 +254,7 @@ const styles = StyleSheet.create({ }, zoomText: { color: Colors.white, fontSize: 12, fontWeight: "700" }, caption: { color: Colors.textSecondary, fontSize: 13, lineHeight: 19, textAlign: "center" }, - dots: { - flexDirection: "row", - alignItems: "center", - justifyContent: "center", - gap: 7, - }, + dots: { flexDirection: "row", flexWrap: "wrap", justifyContent: "center", gap: 7 }, dot: { width: 7, height: 7, borderRadius: 4, backgroundColor: Colors.border }, dotActive: { width: 18, backgroundColor: Colors.primary }, });