UNPKG

react-native-turbo-haptics

Version:
46 lines (45 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.triggerHaptics = exports.HapticTypes = void 0; var _initModule = require("./initModule"); const HapticTypes = exports.HapticTypes = { impactHeavy: 'impactHeavy', impactLight: 'impactLight', impactMedium: 'impactMedium', notificationError: 'notificationError', notificationSuccess: 'notificationSuccess', notificationWarning: 'notificationWarning', rigid: 'rigid', selection: 'selection', soft: 'soft' }; /** * #### `🌀 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 */ const triggerHaptics = exports.triggerHaptics = _initModule.internalTrigger; //# sourceMappingURL=index.js.map