import React from 'react' import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native' import {AppBskyEmbedImages} from '@atproto/api' import {GalleryItem} from './Gallery' interface ImageLayoutGridProps { images: AppBskyEmbedImages.ViewImage[] onPress?: (index: number) => void onLongPress?: (index: number) => void onPressIn?: (index: number) => void style?: StyleProp } export function ImageLayoutGrid({style, ...props}: ImageLayoutGridProps) { return ( ) } interface ImageLayoutGridInnerProps { images: AppBskyEmbedImages.ViewImage[] onPress?: (index: number) => void onLongPress?: (index: number) => void onPressIn?: (index: number) => void } function ImageLayoutGridInner(props: ImageLayoutGridInnerProps) { const count = props.images.length switch (count) { case 2: return ( ) case 3: return ( ) case 4: return ( <> ) default: return null } } // This is used to compute margins (rather than flexbox gap) due to Yoga bugs: // https://github.com/facebook/yoga/issues/1418 const IMAGE_GAP = 5 const styles = StyleSheet.create({ container: { marginHorizontal: -IMAGE_GAP / 2, marginVertical: -IMAGE_GAP / 2, }, flexRow: {flexDirection: 'row'}, smallItem: {flex: 1, aspectRatio: 1}, image: { margin: IMAGE_GAP / 2, }, })