Documentation

Hey friend! We are co-hosting a conference with Software Mansion, learn more.

Haptic

Provides haptic feedback for iOS 10+ devices using the Taptic Engine.
If this is used in Android the device will use ReactNative.Vibrate instead, it's best to just avoid this.
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: Expo.Constants.platform.ios.systemVersion or Expo.Constants.platform.ios.platform

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

Haptic.selection()

PropertyTypeDescription
typeNotificationFeedbackTypeThe kind of notification response used in the feedback

Haptic.notification(Haptic.NotificationTypes.Success)

PropertyTypeDescription
styleImpactFeedbackStyleThe level of impact used in the feedback

Haptic.impact(Haptic.ImpactStyles.Light)

The type of notification generated by a UINotificationFeedbackGenerator object.
const NotificationTypes = {
  'Success': 'success',
  'Warning': 'warning',
  'Error': 'error',
}

A notification feedback type, indicating that a task has completed successfully.

A notification feedback type, indicating that a task has produced a warning.

A notification feedback type, indicating that a task has failed.

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,
}>