This commit is contained in:
Eric Bailey
2026-04-15 16:11:37 -05:00
parent 177c6a68bf
commit 6851c71667
+12 -1
View File
@@ -96,6 +96,7 @@ export function Gallery({
onPressIn, onPressIn,
viewContext, viewContext,
}: GalleryProps) { }: GalleryProps) {
const {t: l} = useLingui()
const ax = useAnalytics() const ax = useAnalytics()
const {screenReaderEnabled} = useA11y() const {screenReaderEnabled} = useA11y()
const largeAltBadge = useLargeAltBadgeEnabled() const largeAltBadge = useLargeAltBadgeEnabled()
@@ -240,6 +241,9 @@ export function Gallery({
<BlockDrawerGesture> <BlockDrawerGesture>
<FlatList <FlatList
ref={flatListRef} ref={flatListRef}
role="group"
aria-roledescription={l`carousel`}
aria-label={l`Image gallery, ${images.length} images`}
horizontal horizontal
pagingEnabled={false} pagingEnabled={false}
showsHorizontalScrollIndicator={false} showsHorizontalScrollIndicator={false}
@@ -258,6 +262,7 @@ export function Gallery({
image={item} image={item}
contentHeight={contentHeight} contentHeight={contentHeight}
index={index} index={index}
imageCount={images.length}
onWidthChange={(i, w) => { onWidthChange={(i, w) => {
itemWidthsRef.current.set(i, w) itemWidthsRef.current.set(i, w)
}} }}
@@ -355,6 +360,7 @@ function GalleryImage({
contentHeight: height, contentHeight: height,
image, image,
index, index,
imageCount,
onWidthChange, onWidthChange,
itemRef, itemRef,
hideBadges, hideBadges,
@@ -367,6 +373,7 @@ function GalleryImage({
contentHeight: number contentHeight: number
image: AppBskyEmbedImages.ViewImage image: AppBskyEmbedImages.ViewImage
index: number index: number
imageCount: number
onWidthChange: (index: number, width: number) => void onWidthChange: (index: number, width: number) => void
itemRef: (node: View | null) => void itemRef: (node: View | null) => void
hideBadges?: boolean hideBadges?: boolean
@@ -395,7 +402,11 @@ function GalleryImage({
}, [index, containerRef, onContainerRef]) }, [index, containerRef, onContainerRef])
return ( return (
<Animated.View ref={containerRef} collapsable={false}> <Animated.View
ref={containerRef}
collapsable={false}
aria-roledescription={l`slide`}
aria-label={image.alt || l`Image ${index + 1} of ${imageCount}`}>
<Pressable <Pressable
ref={itemRef} ref={itemRef}
onPress={onPress} onPress={onPress}