about summary refs log tree commit diff
path: root/src/lib/haptics.ts
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-09-25 17:13:23 +0100
committerGitHub <noreply@github.com>2024-09-25 17:13:23 +0100
commit60b74435358d19322e5e4d08c45e48f58cd1efb1 (patch)
tree0047d3852e11546cff3ae3c91334cce0c29b8dd6 /src/lib/haptics.ts
parent3293c5e0e0bf6fe89596bd0a79dda6cd1a0c2fb5 (diff)
downloadvoidsky-60b74435358d19322e5e4d08c45e48f58cd1efb1.tar.zst
show a toast when a haptic is meant to fire while using simulator (#5481)
buzzz!
Diffstat (limited to 'src/lib/haptics.ts')
-rw-r--r--src/lib/haptics.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/haptics.ts b/src/lib/haptics.ts
index f588808fc..234be777d 100644
--- a/src/lib/haptics.ts
+++ b/src/lib/haptics.ts
@@ -1,8 +1,10 @@
 import React from 'react'
+import * as Device from 'expo-device'
 import {impactAsync, ImpactFeedbackStyle} from 'expo-haptics'
 
 import {isIOS, isWeb} from '#/platform/detection'
 import {useHapticsDisabled} from '#/state/preferences/disable-haptics'
+import * as Toast from '#/view/com/util/Toast'
 
 export function useHaptics() {
   const isHapticsDisabled = useHapticsDisabled()
@@ -18,6 +20,11 @@ export function useHaptics() {
         ? ImpactFeedbackStyle[strength]
         : ImpactFeedbackStyle.Light
       impactAsync(style)
+
+      // DEV ONLY - show a toast when a haptic is meant to fire on simulator
+      if (__DEV__ && !Device.isDevice) {
+        Toast.show(`Buzzz!`)
+      }
     },
     [isHapticsDisabled],
   )