Use Pressable for most links/embeds (#1181)

* delay press on all links

* use Pressable for all accessible links
This commit is contained in:
Eric Bailey 2023-08-24 18:28:26 -05:00 committed by GitHub
parent 4654a9a45e
commit 462022741d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 33 deletions

View file

@ -1,6 +1,6 @@
import {AppBskyEmbedImages} from '@atproto/api'
import React, {ComponentProps, FC} from 'react'
import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'
import {StyleSheet, Text, Pressable, View} from 'react-native'
import {Image} from 'expo-image'
type EventFunction = (index: number) => void
@ -14,8 +14,6 @@ interface GalleryItemProps {
imageStyle: ComponentProps<typeof Image>['style']
}
const DELAY_PRESS_IN = 500
export const GalleryItem: FC<GalleryItemProps> = ({
images,
index,
@ -28,8 +26,7 @@ export const GalleryItem: FC<GalleryItemProps> = ({
return (
<View>
<TouchableOpacity
delayPressIn={DELAY_PRESS_IN}
<Pressable
onPress={onPress ? () => onPress(index) : undefined}
onPressIn={onPressIn ? () => onPressIn(index) : undefined}
onLongPress={onLongPress ? () => onLongPress(index) : undefined}
@ -44,7 +41,7 @@ export const GalleryItem: FC<GalleryItemProps> = ({
accessibilityHint=""
accessibilityIgnoresInvertColors
/>
</TouchableOpacity>
</Pressable>
{image.alt === '' ? null : (
<View style={styles.altContainer}>
<Text style={styles.alt} accessible={false}>