react-native-turbo-haptics
Version:
Fast, worklet-compatible haptic feedback for React Native
40 lines • 1.18 kB
TypeScript
export declare const HapticTypes: {
readonly impactHeavy: "impactHeavy";
readonly impactLight: "impactLight";
readonly impactMedium: "impactMedium";
readonly notificationError: "notificationError";
readonly notificationSuccess: "notificationSuccess";
readonly notificationWarning: "notificationWarning";
readonly rigid: "rigid";
readonly selection: "selection";
readonly soft: "soft";
};
export type HapticType = (typeof HapticTypes)[keyof typeof HapticTypes];
/**
* #### `🌀 triggerHaptics 🌀`
*
* Triggers immediate haptic feedback.
*
* Compatible with worklets (Reanimated, Gesture Handler).
*
* @example
* ```ts
* // In a regular JavaScript context:
* triggerHaptics('selection');
*
* // In a Reanimated worklet:
* useAnimatedReaction(
* () => counter.value,
* (curr, prev) => {
* if (prev === null) return;
* if (curr < prev) triggerHaptics('soft');
* if (curr > prev) triggerHaptics('impactHeavy');
* },
* []
* );
* ```
*
* @param type - The type of haptic feedback to trigger
*/
export declare const triggerHaptics: (type: import(".").HapticType) => void;
//# sourceMappingURL=index.d.ts.map