Something went wrong. Try again.
hardened bluesky app fork with microcosm
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132import {useCallback} from 'react'import * as Device from 'expo-device'import {impactAsync, ImpactFeedbackStyle} from 'expo-haptics'
import {useHapticsDisabled} from '#/state/preferences/disable-haptics'import {IS_IOS, IS_WEB} from '#/env'
export function useHaptics() { const isHapticsDisabled = useHapticsDisabled()
return useCallback( (strength: 'Light' | 'Medium' | 'Heavy' = 'Medium') => { if (isHapticsDisabled || IS_WEB) { return }
// Users said the medium impact was too strong on Android; see APP-537s const style = IS_IOS ? ImpactFeedbackStyle[strength] : ImpactFeedbackStyle.Light impactAsync(style)
// DEV ONLY - show a toast when a haptic is meant to fire on simulator if (__DEV__ && !Device.isDevice) { // disabled because it's annoying // Toast.show(`Buzzz!`) } }, [isHapticsDisabled], )}