diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-10-28 22:03:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-28 20:03:08 +0000 |
commit | d050a78a2d4302d0c2c10ff01f98b575074b1be6 (patch) | |
tree | c8fb7156256da98b5576418a101ff26ce59167a1 /src/view/com/util/fab/FABInner.tsx | |
parent | dcc5405e8a76037763950f2598721a30bb7934aa (diff) | |
download | voidsky-d050a78a2d4302d0c2c10ff01f98b575074b1be6.tar.zst |
Tweak haptics, add to post controls (#5977)
* change timing to 10ms, make ios only * add haptics to post controls * rm from like button
Diffstat (limited to 'src/view/com/util/fab/FABInner.tsx')
-rw-r--r-- | src/view/com/util/fab/FABInner.tsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/view/com/util/fab/FABInner.tsx b/src/view/com/util/fab/FABInner.tsx index b7b06bd7e..3d660732e 100644 --- a/src/view/com/util/fab/FABInner.tsx +++ b/src/view/com/util/fab/FABInner.tsx @@ -10,8 +10,8 @@ import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform' import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {clamp} from '#/lib/numbers' import {gradients} from '#/lib/styles' -import {isWeb} from '#/platform/detection' -import {native} from '#/alf' +import {isIOS, isWeb} from '#/platform/detection' +import {ios} from '#/alf' export interface FABProps extends ComponentProps<typeof TouchableWithoutFeedback> { @@ -41,14 +41,18 @@ export function FABInner({testID, icon, onPress, ...props}: FABProps) { ]}> <PressableScale testID={testID} - onPressIn={() => playHaptic('Light')} + onPressIn={ios(() => playHaptic('Light'))} onPress={evt => { onPress?.(evt) - setTimeout(() => playHaptic('Medium'), 200) + if (isIOS) { + setTimeout(() => playHaptic('Medium'), 10) + } else { + playHaptic('Light') + } }} - onLongPress={native((evt: any) => { + onLongPress={ios((evt: any) => { onPress?.(evt) - setTimeout(() => playHaptic('Heavy'), 200) + playHaptic('Heavy') })} targetScale={0.9} {...props}> |