my fork of the bluesky client

show a toast when a haptic is meant to fire while using simulator (#5481)

buzzz!

authored by samuel.fm and committed by

GitHub 60b74435 3293c5e0

+7
+7
src/lib/haptics.ts
··· 1 import React from 'react' 2 import {impactAsync, ImpactFeedbackStyle} from 'expo-haptics' 3 4 import {isIOS, isWeb} from '#/platform/detection' 5 import {useHapticsDisabled} from '#/state/preferences/disable-haptics' 6 7 export function useHaptics() { 8 const isHapticsDisabled = useHapticsDisabled() ··· 18 ? ImpactFeedbackStyle[strength] 19 : ImpactFeedbackStyle.Light 20 impactAsync(style) 21 }, 22 [isHapticsDisabled], 23 )
··· 1 import React from 'react' 2 + import * as Device from 'expo-device' 3 import {impactAsync, ImpactFeedbackStyle} from 'expo-haptics' 4 5 import {isIOS, isWeb} from '#/platform/detection' 6 import {useHapticsDisabled} from '#/state/preferences/disable-haptics' 7 + import * as Toast from '#/view/com/util/Toast' 8 9 export function useHaptics() { 10 const isHapticsDisabled = useHapticsDisabled() ··· 20 ? ImpactFeedbackStyle[strength] 21 : ImpactFeedbackStyle.Light 22 impactAsync(style) 23 + 24 + // DEV ONLY - show a toast when a haptic is meant to fire on simulator 25 + if (__DEV__ && !Device.isDevice) { 26 + Toast.show(`Buzzz!`) 27 + } 28 }, 29 [isHapticsDisabled], 30 )