Use Pressable for most links/embeds (#1181)
* delay press on all links * use Pressable for all accessible links
This commit is contained in:
parent
4654a9a45e
commit
462022741d
6 changed files with 15 additions and 33 deletions
|
|
@ -1,17 +1,10 @@
|
|||
import React from 'react'
|
||||
import {
|
||||
StyleProp,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
ViewStyle,
|
||||
} from 'react-native'
|
||||
import {StyleProp, StyleSheet, Pressable, View, ViewStyle} from 'react-native'
|
||||
import {Image} from 'expo-image'
|
||||
import {clamp} from 'lib/numbers'
|
||||
import {useStores} from 'state/index'
|
||||
import {Dimensions} from 'lib/media/types'
|
||||
|
||||
export const DELAY_PRESS_IN = 500
|
||||
const MIN_ASPECT_RATIO = 0.33 // 1/3
|
||||
const MAX_ASPECT_RATIO = 5 // 5/1
|
||||
|
||||
|
|
@ -57,11 +50,10 @@ export function AutoSizedImage({
|
|||
|
||||
if (onPress || onLongPress || onPressIn) {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
<Pressable
|
||||
onPress={onPress}
|
||||
onLongPress={onLongPress}
|
||||
onPressIn={onPressIn}
|
||||
delayPressIn={DELAY_PRESS_IN}
|
||||
style={[styles.container, style]}
|
||||
accessible={true}
|
||||
accessibilityRole="button"
|
||||
|
|
@ -74,7 +66,7 @@ export function AutoSizedImage({
|
|||
accessibilityIgnoresInvertColors
|
||||
/>
|
||||
{children}
|
||||
</TouchableOpacity>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue