From 50910d8b60e6e4f847dd8ab62b44881575ec298d Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sat, 2 Dec 2023 17:47:24 -0800 Subject: [PATCH] Move the alt text indicator off of the images --- src/view/com/util/images/Gallery.tsx | 23 +------------- src/view/com/util/post-embeds/index.tsx | 42 +++++++++++++++---------- 2 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/view/com/util/images/Gallery.tsx b/src/view/com/util/images/Gallery.tsx index 094b0c56cc..833ab75ac6 100644 --- a/src/view/com/util/images/Gallery.tsx +++ b/src/view/com/util/images/Gallery.tsx @@ -1,6 +1,6 @@ import {AppBskyEmbedImages} from '@atproto/api' import React, {ComponentProps, FC} from 'react' -import {StyleSheet, Text, Pressable, View} from 'react-native' +import {StyleSheet, Pressable, View} from 'react-native' import {Image} from 'expo-image' type EventFunction = (index: number) => void @@ -42,13 +42,6 @@ export const GalleryItem: FC = ({ accessibilityIgnoresInvertColors /> - {image.alt === '' ? null : ( - - - ALT - - - )} ) } @@ -61,18 +54,4 @@ const styles = StyleSheet.create({ flex: 1, borderRadius: 4, }, - altContainer: { - backgroundColor: 'rgba(0, 0, 0, 0.75)', - borderRadius: 6, - paddingHorizontal: 6, - paddingVertical: 3, - position: 'absolute', - left: 8, - bottom: 8, - }, - alt: { - color: 'white', - fontSize: 10, - fontWeight: 'bold', - }, }) diff --git a/src/view/com/util/post-embeds/index.tsx b/src/view/com/util/post-embeds/index.tsx index ca3bf11044..0526e2dc74 100644 --- a/src/view/com/util/post-embeds/index.tsx +++ b/src/view/com/util/post-embeds/index.tsx @@ -6,6 +6,7 @@ import { ViewStyle, Text, InteractionManager, + Pressable, } from 'react-native' import {Image} from 'expo-image' import { @@ -122,18 +123,20 @@ export function PostEmbeds({ dimensionsHint={aspectRatio} onPress={() => _openLightbox(0)} onPressIn={() => onPressIn(0)} - style={[ - styles.singleImage, - isMobile && styles.singleImageMobile, - ]}> - {alt === '' ? null : ( - - + style={[styles.singleImage, isMobile && styles.singleImageMobile]} + /> + {alt === '' ? null : ( + + _openLightbox(0)}> + ALT - - )} - + + + )} ) } @@ -150,6 +153,18 @@ export function PostEmbeds({ : undefined } /> + {embed.images.find(img => img.alt !== '') ? ( + + _openLightbox(0)}> + + ALT + + + + ) : null} ) } @@ -198,16 +213,11 @@ const styles = StyleSheet.create({ marginTop: 4, }, altContainer: { - backgroundColor: 'rgba(0, 0, 0, 0.75)', - borderRadius: 6, + borderRadius: 8, paddingHorizontal: 6, paddingVertical: 3, - position: 'absolute', - left: 6, - bottom: 6, }, alt: { - color: 'white', fontSize: 10, fontWeight: 'bold', },