Adjust pointer, overscroll, focus
This commit is contained in:
@@ -24,7 +24,7 @@ import {mergeRefs} from '#/lib/merge-refs'
|
|||||||
import {useA11y} from '#/state/a11y'
|
import {useA11y} from '#/state/a11y'
|
||||||
import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge'
|
import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge'
|
||||||
import {BlockDrawerGesture} from '#/view/shell/BlockDrawerGesture'
|
import {BlockDrawerGesture} from '#/view/shell/BlockDrawerGesture'
|
||||||
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
import {ArrowsDiagonalOut_Stroke2_Corner0_Rounded as Fullscreen} from '#/components/icons/ArrowsDiagonal'
|
import {ArrowsDiagonalOut_Stroke2_Corner0_Rounded as Fullscreen} from '#/components/icons/ArrowsDiagonal'
|
||||||
import {AutoSizedImage} from '#/components/images/AutoSizedImage'
|
import {AutoSizedImage} from '#/components/images/AutoSizedImage'
|
||||||
import {
|
import {
|
||||||
@@ -376,6 +376,7 @@ function GalleryImage({
|
|||||||
}) {
|
}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
|
const [focused, setFocused] = useState(false)
|
||||||
const containerRef = useAnimatedRef()
|
const containerRef = useAnimatedRef()
|
||||||
const [aspectRatio, setAspectRatio] = useState(() =>
|
const [aspectRatio, setAspectRatio] = useState(() =>
|
||||||
getAspectRatio(image.aspectRatio),
|
getAspectRatio(image.aspectRatio),
|
||||||
@@ -397,6 +398,8 @@ function GalleryImage({
|
|||||||
ref={itemRef}
|
ref={itemRef}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
onPressIn={onPressIn}
|
onPressIn={onPressIn}
|
||||||
|
onFocus={() => setFocused(true)}
|
||||||
|
onBlur={() => setFocused(false)}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel={image.alt || l`Image ${index + 1}`}
|
accessibilityLabel={image.alt || l`Image ${index + 1}`}
|
||||||
accessibilityHint={l`Opens full image`}
|
accessibilityHint={l`Opens full image`}
|
||||||
@@ -404,7 +407,16 @@ function GalleryImage({
|
|||||||
color: utils.alpha(t.atoms.bg.backgroundColor, 0.2),
|
color: utils.alpha(t.atoms.bg.backgroundColor, 0.2),
|
||||||
foreground: true,
|
foreground: true,
|
||||||
}}
|
}}
|
||||||
style={[a.rounded_md, a.overflow_hidden, t.atoms.bg_contrast_25]}>
|
style={[
|
||||||
|
a.rounded_md,
|
||||||
|
a.overflow_hidden,
|
||||||
|
t.atoms.bg_contrast_25,
|
||||||
|
web({
|
||||||
|
cursor: 'inherit',
|
||||||
|
outline: 0,
|
||||||
|
border: 0,
|
||||||
|
}),
|
||||||
|
]}>
|
||||||
<Image
|
<Image
|
||||||
source={{uri: image.thumb}}
|
source={{uri: image.thumb}}
|
||||||
contentFit="cover"
|
contentFit="cover"
|
||||||
@@ -486,7 +498,13 @@ function GalleryImage({
|
|||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<MediaInsetBorder />
|
<MediaInsetBorder
|
||||||
|
style={
|
||||||
|
focused && {
|
||||||
|
borderWidth: 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ const FLICK_MIN_VELOCITY = 0.1
|
|||||||
const ADVANCE_THRESHOLD = 0.15
|
const ADVANCE_THRESHOLD = 0.15
|
||||||
const FRAME_MS = 1000 / 60
|
const FRAME_MS = 1000 / 60
|
||||||
const SETTLE_DURATION = 600
|
const SETTLE_DURATION = 600
|
||||||
const OVERSCROLL_RESISTANCE = 0.3
|
const OVERSCROLL_RESISTANCE = 0.4
|
||||||
const BOUNCE_DURATION = 400
|
const BOUNCE_DURATION = 700
|
||||||
|
|
||||||
function whichByDistance(
|
function whichByDistance(
|
||||||
itemWidths: Map<number, number>,
|
itemWidths: Map<number, number>,
|
||||||
|
|||||||
Reference in New Issue
Block a user