allow image to clicked to go to post in notificaitons (#858)

zio/stable
Ansh 2023-06-07 07:57:49 -07:00 committed by GitHub
parent bdcdb4e4dc
commit fc12a1205c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 36 deletions

View File

@ -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={[

View File

@ -1,41 +1,17 @@
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)}
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
}
}}>
{images.map(({thumb, alt}) => (
<Image
source={{uri: thumb}}
style={styles.image}
@ -44,7 +20,6 @@ export function ImageHorzList({images, onPress, style}: Props) {
accessibilityHint={alt}
accessibilityLabel=""
/>
</TouchableWithoutFeedback>
))}
</View>
)