diff options
author | Hailey <me@haileyok.com> | 2024-05-08 13:56:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 13:56:36 -0700 |
commit | f62b0458a742dc7e00c5ca75064718bc6fef53b7 (patch) | |
tree | 71295244e4858337146ef9fc0298e0e8ab6c081c /src | |
parent | 701e508a1a5a99389242282a82973a3015070509 (diff) | |
download | voidsky-f62b0458a742dc7e00c5ca75064718bc6fef53b7.tar.zst |
[🐴] Adjust press and hold delay on messages (#3918)
* adjust press and hold delay on messages * adjust hit slop
Diffstat (limited to 'src')
-rw-r--r-- | src/components/dms/ActionsWrapper.tsx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/dms/ActionsWrapper.tsx b/src/components/dms/ActionsWrapper.tsx index 19a3e0424..315f459de 100644 --- a/src/components/dms/ActionsWrapper.tsx +++ b/src/components/dms/ActionsWrapper.tsx @@ -1,4 +1,4 @@ -import React, {useCallback} from 'react' +import React from 'react' import {Keyboard, Pressable, View} from 'react-native' import Animated, { cancelAnimation, @@ -9,6 +9,7 @@ import Animated, { } from 'react-native-reanimated' import {ChatBskyConvoDefs} from '@atproto-labs/api' +import {HITSLOP_10} from 'lib/constants' import {useHaptics} from 'lib/haptics' import {atoms as a} from '#/alf' import {MessageMenu} from '#/components/dms/MessageMenu' @@ -37,12 +38,12 @@ export function ActionsWrapper({ // Reanimated's `runOnJS` doesn't like refs, so we can't use `runOnJS(menuControl.open)()`. Instead, we'll use this // function - const open = useCallback(() => { + const open = React.useCallback(() => { Keyboard.dismiss() menuControl.open() }, [menuControl]) - const shrink = useCallback(() => { + const shrink = React.useCallback(() => { 'worklet' cancelAnimation(scale) scale.value = withTiming(1, {duration: 200}, () => { @@ -52,7 +53,7 @@ export function ActionsWrapper({ const grow = React.useCallback(() => { 'worklet' - scale.value = withTiming(1.05, {duration: 750}, finished => { + scale.value = withTiming(1.05, {duration: 450}, finished => { if (!finished) return animationDidComplete.value = true runOnJS(playHaptic)() @@ -74,7 +75,8 @@ export function ActionsWrapper({ style={animatedStyle} unstable_pressDelay={200} onPressIn={grow} - onTouchEnd={shrink}> + onTouchEnd={shrink} + hitSlop={HITSLOP_10}> {children} </AnimatedPressable> <MessageMenu message={message} control={menuControl} hideTrigger={true} /> |