diff options
author | dan <dan.abramov@gmail.com> | 2023-10-12 19:14:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-12 19:14:27 +0100 |
commit | c2a1cf4e56780b60fa8d140f9c7c855567851f5c (patch) | |
tree | ca66af3c410b4daa2454a8de12af3968569ec7b7 /src/view/com/util/images/Gallery.tsx | |
parent | d98e3a8b45a400bb7f0abbf3c69d509f8269d07a (diff) | |
download | voidsky-c2a1cf4e56780b60fa8d140f9c7c855567851f5c.tar.zst |
Fix layout shift for multi-image posts (#1673)
* Fix layout shift for multi-image posts * Add a comment for the hack * Use margins instead of gap * Move alt label
Diffstat (limited to 'src/view/com/util/images/Gallery.tsx')
-rw-r--r-- | src/view/com/util/images/Gallery.tsx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/view/com/util/images/Gallery.tsx b/src/view/com/util/images/Gallery.tsx index 679f71c99..094b0c56c 100644 --- a/src/view/com/util/images/Gallery.tsx +++ b/src/view/com/util/images/Gallery.tsx @@ -23,19 +23,19 @@ export const GalleryItem: FC<GalleryItemProps> = ({ onLongPress, }) => { const image = images[index] - return ( - <View> + <View style={styles.fullWidth}> <Pressable onPress={onPress ? () => onPress(index) : undefined} onPressIn={onPressIn ? () => onPressIn(index) : undefined} onLongPress={onLongPress ? () => onLongPress(index) : undefined} + style={styles.fullWidth} accessibilityRole="button" accessibilityLabel={image.alt || 'Image'} accessibilityHint=""> <Image source={{uri: image.thumb}} - style={imageStyle} + style={[styles.image, imageStyle]} accessible={true} accessibilityLabel={image.alt} accessibilityHint="" @@ -54,14 +54,21 @@ export const GalleryItem: FC<GalleryItemProps> = ({ } const styles = StyleSheet.create({ + fullWidth: { + flex: 1, + }, + image: { + flex: 1, + borderRadius: 4, + }, altContainer: { backgroundColor: 'rgba(0, 0, 0, 0.75)', borderRadius: 6, paddingHorizontal: 6, paddingVertical: 3, position: 'absolute', - left: 6, - bottom: 6, + left: 8, + bottom: 8, }, alt: { color: 'white', |