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
This commit is contained in:
parent
d98e3a8b45
commit
c2a1cf4e56
2 changed files with 65 additions and 66 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue