allow image to clicked to go to post in notificaitons (#858)
parent
bdcdb4e4dc
commit
fc12a1205c
|
@ -165,7 +165,7 @@ export const FeedItem = observer(function ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line react-native-a11y/no-nested-touchables
|
||||||
<Link
|
<Link
|
||||||
testID={`feedItem-by-${item.author.handle}`}
|
testID={`feedItem-by-${item.author.handle}`}
|
||||||
style={[
|
style={[
|
||||||
|
|
|
@ -1,50 +1,25 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {
|
import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native'
|
||||||
StyleProp,
|
|
||||||
StyleSheet,
|
|
||||||
TouchableWithoutFeedback,
|
|
||||||
View,
|
|
||||||
ViewStyle,
|
|
||||||
} from 'react-native'
|
|
||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {AppBskyEmbedImages} from '@atproto/api'
|
import {AppBskyEmbedImages} from '@atproto/api'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
images: AppBskyEmbedImages.ViewImage[]
|
images: AppBskyEmbedImages.ViewImage[]
|
||||||
onPress?: (index: number) => void
|
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ImageHorzList({images, onPress, style}: Props) {
|
export function ImageHorzList({images, style}: Props) {
|
||||||
const numImages = images.length
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.flexRow, style]}>
|
<View style={[styles.flexRow, style]}>
|
||||||
{images.map(({thumb, alt}, i) => (
|
{images.map(({thumb, alt}) => (
|
||||||
<TouchableWithoutFeedback
|
<Image
|
||||||
key={i}
|
source={{uri: thumb}}
|
||||||
onPress={() => onPress?.(i)}
|
style={styles.image}
|
||||||
accessible={true}
|
accessible={true}
|
||||||
accessibilityLabel={`Open image ${i} of ${numImages}`}
|
accessibilityIgnoresInvertColors
|
||||||
accessibilityHint="Opens image in viewer"
|
accessibilityHint={alt}
|
||||||
accessibilityActions={[{name: 'press', label: 'Press'}]}
|
accessibilityLabel=""
|
||||||
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>
|
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue