v2 Reference
This page documents the v2.x API for users who have not yet migrated to v3. The latest stable release is v3 — see the Migration guide for upgrade steps.
End of life
v2 is no longer maintained. Bug fixes and new features are only added to v3.
Installation
npm install react-native-haptic-feedback@2
# or
yarn add react-native-haptic-feedback@2React Native 0.60+ uses auto-linking — no extra steps needed. For older versions, run react-native link react-native-haptic-feedback.
Usage
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
const options = {
enableVibrateFallback: true,
ignoreAndroidSystemSettings: false,
};
ReactNativeHapticFeedback.trigger("impactLight", options);Named export:
import { trigger } from "react-native-haptic-feedback";
trigger("impactLight", options);API
trigger(type, options?)
The only method available in v2.
| Parameter | Type | Default | Description |
|---|---|---|---|
type | string | — | Haptic feedback type (see table below) |
options.enableVibrateFallback | boolean | false | iOS: fall back to system vibration on devices without a Taptic Engine |
options.ignoreAndroidSystemSettings | boolean | false | Android: trigger even if vibration is disabled in system settings |
Feedback types
Many types were platform-specific in v2. All types work on both platforms in v3.
| Type | Android | iOS |
|---|---|---|
impactLight | ✅ | ✅ |
impactMedium | ✅ | ✅ |
impactHeavy | ✅ | ✅ |
rigid | ✅ | ✅ |
soft | ✅ | ✅ |
notificationSuccess | ✅ | ✅ |
notificationWarning | ✅ | ✅ |
notificationError | ✅ | ✅ |
selection | ❌ | ✅ |
clockTick | ✅ | ❌ |
contextClick | ✅ | ❌ |
keyboardPress | ✅ | ❌ |
keyboardRelease | ✅ | ❌ |
keyboardTap | ✅ | ❌ |
longPress | ✅ | ❌ |
textHandleMove | ✅ | ❌ |
virtualKey | ✅ | ❌ |
virtualKeyRelease | ✅ | ❌ |
effectClick | ✅ | ❌ |
effectDoubleClick | ✅ | ❌ |
effectHeavyClick | ✅ | ❌ |
effectTick | ✅ | ❌ |
Platform notes
iOS — v2 used UIKit feedback generators (UIImpactFeedbackGenerator, UINotificationFeedbackGenerator, UISelectionFeedbackGenerator). This caused a 25-second rate-limiting issue and occasional NSInternalInconsistencyException crashes. Both are fixed in v3 via CHHapticEngine.
Android — v2 used VibrationEffect.createWaveform (API 26+) or a raw waveform fallback. On API 23–25 (Android 6–7) a plain Vibrator.vibrate() call was used. The Android 8 crash is fixed in v3.
What's new in v3
v3 adds full cross-platform type support, Core Haptics on iOS, richer Android Composition API, and several new APIs:
triggerPattern()— custom multi-event sequencespattern()— compact notation helper ("oO.O")playAHAP()/playHaptic()— AHAP file playbackgetSystemHapticStatus()— ringer mode and vibration availabilityisSupported()— runtime Core Haptics checkstop()— cancel active hapticsuseHapticshook andTouchableHapticcomponent- 15 new haptic types
See the Migration guide for the full list of changes and upgrade steps.