Expo

Documentation

Haptic

This API will be renamed to Haptics in SDK 33. If you are using the bare workflow, use that API now instead: Haptics.
Provides haptic feedback for iOS 10+ devices using the Taptic Engine. If this is used in Android, the device will use ReactNative.Vibrate instead.
The Taptic engine will do nothing given the following circumstances:
  • Low Power Mode is enabled
  • User disabled the Taptic Engine in settings
  • 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 pre-installed in managed apps. Use Haptics in a bare React Native app instead of Haptic.

// in managed apps:
import { Haptic } from 'expo';

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

Haptic.selection()

PropertyTypeDescription
styleImpactFeedbackStyleThe level of impact used in the feedback

Haptic.impact(Haptic.ImpactFeedbackStyle.Light)

The mass of the objects in the collision simulated by a UIImpactFeedbackGenerator object.
const ImpactStyles = {
  'Light': 'light',
  'Medium': 'medium',
  'Heavy': 'heavy',
}

A collision between small, light user interface elements.

A collision between moderately sized user interface elements.

A collision between large, heavy user interface elements.

The type of notification generated by a UINotificationFeedbackGenerator object.
$Enum<{
  success: string,
  warning: string,
  error: string,
}>

The mass of the objects in the collision simulated by a UIImpactFeedbackGenerator object.
$Enum<{
  light: string,
  medium: string,
  heavy: string,
}>