React Native · APIs and utilities
Haptics
Haptic feedback.
3 exports
Import
Haptics
moduleHaptic feedback. Calls can be used without awaiting (errors are swallowed).
| Name | Type | Description |
|---|---|---|
isSupported | () => boolean | Whether the device has a vibration motor. |
impact | (style?: ImpactStyle) => Promise<void> | Tap/impact feel (buttons, drag and drop). |
notification | (type?: NotificationFeedback) => Promise<void> | Result feel: success (two short), warning, error (three short). |
selection | () => Promise<void> | Selection changed feel (slider step, picker). The lightest feedback. |
vibrate | (pattern?: number | readonly number[]) => Promise<void> | Free-form vibration. A number: duration (ms). An array: [wait, vibrate, wait, vibrate…] (ms). iOS does not allow setting the duration: the system vibration (~400 ms) plays once for each vibration in the pattern. |
cancel | () => Promise<void> | Stops an ongoing vibration. |
ImpactStyle
typeImpact strength: light, medium, heavy; soft soft, rigid hard/short.
Result notification: success, warning or error.