0.3.1 • Published 2 months ago
react-native-rich-vibration v0.3.1
React Native Rich Vibration
This React Native library provides an alternative to the standard vibrations API, integrating haptic feedback for a more immersive user experience. With customizable options for intensity, duration, and sharpness, you have greater control over how vibrations feel in your application.
⚠️ This library requires your mobile device to have a haptic engine.
Installation
Install the module using npm or yarn:
npx expo install react-native-rich-vibration
Demo
Watch the demo video below to see the React Native Rich Vibration module in action:
Usage
import * as ReactNativeRichVibration from "react-native-rich-vibration";
// Check for Haptics Support
ReactNativeRichVibration.hasHaptics()
// Vibrate with Custom Duration and Intensity (Sharpness for iOS)
// For Android: vibrate(duration: number, intensity: number)
// For iOS: vibrate(duration: number, intensity: number, sharpness?: number)
ReactNativeRichVibration.vibrate(400, 50); // For Android
ReactNativeRichVibration.vibrate(400, 50, 40); // For iOS
// Cancel Ongoing Vibration
ReactNativeRichVibration.cancelVibration();