diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-10-28 21:02:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-28 21:02:38 +0200 |
commit | 5bce043e1ebad182b06f63daab8b7e397771578e (patch) | |
tree | bb50c03ff6af319a0a1e796205b49caaaf985a24 /src/view/com/util/fab/FABInner.tsx | |
parent | 2e3844c7b428d6479246f4d51993679f0e5cb33f (diff) | |
download | voidsky-5bce043e1ebad182b06f63daab8b7e397771578e.tar.zst |
FAB - delay followup haptic (#5974)
Diffstat (limited to 'src/view/com/util/fab/FABInner.tsx')
-rw-r--r-- | src/view/com/util/fab/FABInner.tsx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/view/com/util/fab/FABInner.tsx b/src/view/com/util/fab/FABInner.tsx index 16009bf44..b7b06bd7e 100644 --- a/src/view/com/util/fab/FABInner.tsx +++ b/src/view/com/util/fab/FABInner.tsx @@ -11,7 +11,7 @@ import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {clamp} from '#/lib/numbers' import {gradients} from '#/lib/styles' import {isWeb} from '#/platform/detection' -import {useHapticsDisabled} from '#/state/preferences' +import {native} from '#/alf' export interface FABProps extends ComponentProps<typeof TouchableWithoutFeedback> { @@ -23,7 +23,6 @@ export function FABInner({testID, icon, onPress, ...props}: FABProps) { const insets = useSafeAreaInsets() const {isMobile, isTablet} = useWebMediaQueries() const playHaptic = useHaptics() - const isHapticsDisabled = useHapticsDisabled() const fabMinimalShellTransform = useMinimalShellFabTransform() const size = isTablet ? styles.sizeLarge : styles.sizeRegular @@ -43,14 +42,14 @@ export function FABInner({testID, icon, onPress, ...props}: FABProps) { <PressableScale testID={testID} onPressIn={() => playHaptic('Light')} - onPress={e => { - playHaptic('Light') - setTimeout(() => onPress?.(e), isHapticsDisabled ? 0 : 75) - }} - onLongPress={e => { - playHaptic('Medium') - setTimeout(() => onPress?.(e), isHapticsDisabled ? 0 : 75) + onPress={evt => { + onPress?.(evt) + setTimeout(() => playHaptic('Medium'), 200) }} + onLongPress={native((evt: any) => { + onPress?.(evt) + setTimeout(() => playHaptic('Heavy'), 200) + })} targetScale={0.9} {...props}> <LinearGradient |