Expo

Documentation

Hi friend! Meet us at App.js Conf in Krakow, Poland on April 4th and 5th with workshops and talks. Learn more

Haptics

The following API docs apply to the Haptics Unimodule available to the bare workflow. Use Haptic for the managed workflow.
Provides haptic feedback for
  • iOS 10+ devices using the Taptic Engine
  • Android devices using Vibrator system service.
On iOS, the Taptic engine will do nothing if any of the following conditions are true on a user's device:
  • Low Power Mode is enabled (Feature Request)
  • User disabled the Taptic Engine in settings (Feature Request)
  • Haptic engine generation is to low (less than 2nd gen) - Private API
    • Using private API will get your app rejected: [[UIDevice currentDevice] valueForKey: @"_feedbackSupportLevel"] so this is not added in Expo
  • iOS version is less than 10 (iPhone 7 is the first phone to support this)
    • This could be found through: Constants.platform.ios.systemVersion or Constants.platform.ios.platform

This API is currently called Haptic in the managed workflow, refer to that page instead. To use Haptics in a bare React Native app, follow its installation instructions.

// in bare apps:
import * as Haptics from 'expo-haptics';

Used to let a user know when a selection change has been registered

A Promise resolving once native size haptics functionality is triggered.

The kind of notification response used in the feedback

  • type: NotificationFeedbackType -- A notification feedback type that on iOS is directly mapped to UINotificationFeedbackType, while on Android these ar e simulated using Vibrator. You can use one of Haptics.NotificationFeedbackType.{Success, Warning, Error}.

A Promise resolving once native size haptics functionality is triggered.

  • style: ImpactFeedbackStyle -- A collision indicator that on iOS is directly mapped to UIImpactFeedbackStyle, while on Android these ar e simulated using Vibrator. You can use one of Haptics.ImpactFeedbackStyle.{Light, Medium, Heavy}.

A Promise resolving once native size haptics functionality is triggered.