Skip to main content

expo-haptics

Version: 55.0.6 Provides access to the system’s haptics engine on iOS, vibration effects on Android, and Web Vibration API on web.

Installation

Usage

API Reference

Impact Feedback

(style: ImpactFeedbackStyle) => Promise<void>
Triggers impact haptic feedbackStyles:
  • Haptics.ImpactFeedbackStyle.Light
  • Haptics.ImpactFeedbackStyle.Medium
  • Haptics.ImpactFeedbackStyle.Heavy
  • Haptics.ImpactFeedbackStyle.Rigid (iOS 13+)
  • Haptics.ImpactFeedbackStyle.Soft (iOS 13+)

Notification Feedback

(type: NotificationFeedbackType) => Promise<void>
Triggers notification haptic feedbackTypes:
  • Haptics.NotificationFeedbackType.Success
  • Haptics.NotificationFeedbackType.Warning
  • Haptics.NotificationFeedbackType.Error

Selection Feedback

() => Promise<void>
Triggers selection change haptic feedback

Examples

Button Press Feedback

Form Validation Feedback

Picker Selection

Different Impact Levels

Platform Support

iOS: Uses UIImpactFeedbackGenerator, UINotificationFeedbackGenerator, and UISelectionFeedbackGeneratorAndroid: Uses VibrationEffect (API 26+) or Vibrator for older versionsWeb: Uses the Vibration API where supported

Best Practices

  1. Use Sparingly: Overuse can be annoying
  2. Match Interaction: Use appropriate feedback type for the interaction
  3. Respect Settings: Haptics honor system settings (vibration off, etc.)
  4. Light for UI: Use Light impact for most UI interactions
  5. Notifications for States: Use notification feedback for success/error states

Resources