react-native-haptic-feedback
Version:
Basic haptic feedback for iOS and android
42 lines • 1.91 kB
TypeScript
import { HapticFeedbackTypes } from "./types";
import type { HapticOptions, HapticEvent, SystemHapticStatus } from "./types";
declare const RNHapticFeedback: {
/**
* Enable or disable all haptic feedback library-wide.
* Useful for respecting a user's in-app haptics preference.
* The setting is in-memory only — persist it yourself if needed across sessions.
*/
setEnabled(value: boolean): void;
/** Returns whether haptic feedback is currently enabled. */
isEnabled(): boolean;
trigger(type?: keyof typeof HapticFeedbackTypes | HapticFeedbackTypes, options?: HapticOptions): void;
stop(): void;
isSupported(): boolean;
triggerPattern(events: HapticEvent[], options?: HapticOptions): void;
/**
* Play an Apple Haptic and Audio Pattern (AHAP) file by name.
*
* Place `.ahap` files in `<bundle>/haptics/` or the bundle root.
* Resolves immediately on Android (AHAP is an Apple-only format).
*
* For cross-platform usage, prefer `playHaptic(ahapFile, fallback)`.
*
* @platform ios
*/
playAHAP(fileName: string): Promise<void>;
/**
* Play a haptic with a custom intensity (0.0–1.0).
*
* On iOS (Core Haptics), the intensity is applied precisely via CHHapticEngine.
* On Android it maps to `VibrationEffect` amplitude.
* On devices without haptic hardware this is a no-op.
*
* @param type - haptic type that determines the base sharpness/character (default `impactMedium`)
* @param intensity - 0.0 (silent) to 1.0 (maximum), default 0.7
* @param options - same options as `trigger()`
*/
impact(type?: keyof typeof HapticFeedbackTypes | HapticFeedbackTypes, intensity?: number, options?: HapticOptions): void;
getSystemHapticStatus(): Promise<SystemHapticStatus>;
};
export default RNHapticFeedback;
//# sourceMappingURL=hapticFeedback.d.ts.map