Files
gtd/app/src/lib/haptics.ts
Marcus Rehbock 0487bc7e4e
All checks were successful
Build & Release APK / build (push) Successful in 1m53s
Todoist-style: priorities P1-P4, estimates, FAB add form, Today view, natural quick add, drag-and-drop with haptics
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 19:46:11 -07:00

25 lines
803 B
TypeScript

// Haptics that silently no-op on web.
import * as Haptics from "expo-haptics";
import { Platform } from "react-native";
const canBuzz = Platform.OS !== "web";
export const haptic = {
/** Light tick — captures, small confirmations. */
tap: () => {
if (canBuzz) void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
},
/** Medium thunk — picking up a draggable. */
pickup: () => {
if (canBuzz) void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
},
/** Success notification — completing a task, landing a drop. */
success: () => {
if (canBuzz) void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
},
/** Selection change — flicking through chips. */
select: () => {
if (canBuzz) void Haptics.selectionAsync();
},
};