From fc12a1205cceab323f1165205cd68268ff291436 Mon Sep 17 00:00:00 2001 From: Ansh <anshnanda10@gmail.com> Date: Wed, 7 Jun 2023 07:57:49 -0700 Subject: [PATCH] allow image to clicked to go to post in notificaitons (#858) --- src/view/com/notifications/FeedItem.tsx | 2 +- src/view/com/util/images/ImageHorzList.tsx | 45 +++++----------------- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index ac2e2a19..7994c53a 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -165,7 +165,7 @@ export const FeedItem = observer(function ({ } return ( - // eslint-disable-next-line + // eslint-disable-next-line react-native-a11y/no-nested-touchables <Link testID={`feedItem-by-${item.author.handle}`} style={[ diff --git a/src/view/com/util/images/ImageHorzList.tsx b/src/view/com/util/images/ImageHorzList.tsx index 88494bba..14a8dd7e 100644 --- a/src/view/com/util/images/ImageHorzList.tsx +++ b/src/view/com/util/images/ImageHorzList.tsx @@ -1,50 +1,25 @@ import React from 'react' -import { - StyleProp, - StyleSheet, - TouchableWithoutFeedback, - View, - ViewStyle, -} from 'react-native' +import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native' import {Image} from 'expo-image' import {AppBskyEmbedImages} from '@atproto/api' interface Props { images: AppBskyEmbedImages.ViewImage[] - onPress?: (index: number) => void style?: StyleProp<ViewStyle> } -export function ImageHorzList({images, onPress, style}: Props) { - const numImages = images.length +export function ImageHorzList({images, style}: Props) { return ( <View style={[styles.flexRow, style]}> - {images.map(({thumb, alt}, i) => ( - <TouchableWithoutFeedback - key={i} - onPress={() => onPress?.(i)} + {images.map(({thumb, alt}) => ( + <Image + source={{uri: thumb}} + style={styles.image} accessible={true} - accessibilityLabel={`Open image ${i} of ${numImages}`} - accessibilityHint="Opens image in viewer" - accessibilityActions={[{name: 'press', label: 'Press'}]} - onAccessibilityAction={action => { - switch (action.nativeEvent.actionName) { - case 'press': - onPress?.(0) - break - default: - break - } - }}> - <Image - source={{uri: thumb}} - style={styles.image} - accessible={true} - accessibilityIgnoresInvertColors - accessibilityHint={alt} - accessibilityLabel="" - /> - </TouchableWithoutFeedback> + accessibilityIgnoresInvertColors + accessibilityHint={alt} + accessibilityLabel="" + /> ))} </View> )