All checks were successful
Build & Release APK / build (push) Successful in 1m53s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
803 B
TypeScript
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();
|
|
},
|
|
};
|