import {AppBskyEmbedImages} from '@atproto/api' import React, {ComponentProps, FC} from 'react' import {StyleSheet, Text, Pressable, View} from 'react-native' import {Image} from 'expo-image' type EventFunction = (index: number) => void interface GalleryItemProps { images: AppBskyEmbedImages.ViewImage[] index: number onPress?: EventFunction onLongPress?: EventFunction onPressIn?: EventFunction imageStyle: ComponentProps['style'] } export const GalleryItem: FC = ({ images, index, imageStyle, onPress, onPressIn, onLongPress, }) => { const image = images[index] return ( onPress(index) : undefined} onPressIn={onPressIn ? () => onPressIn(index) : undefined} onLongPress={onLongPress ? () => onLongPress(index) : undefined} accessibilityRole="button" accessibilityLabel={image.alt || 'Image'} accessibilityHint=""> {image.alt === '' ? null : ( ALT )} ) } const styles = StyleSheet.create({ altContainer: { backgroundColor: 'rgba(0, 0, 0, 0.75)', borderRadius: 6, paddingHorizontal: 6, paddingVertical: 3, position: 'absolute', left: 6, bottom: 6, }, alt: { color: 'white', fontSize: 10, fontWeight: 'bold', }, })