Quick start
Trigger your first haptic feedback with @mhpdev/react-native-haptics.
Import the default Haptics object and call one of its methods:
import React from 'react';
import Haptics from '@mhpdev/react-native-haptics';
import {SafeAreaView, StyleSheet, Text, TouchableOpacity} from 'react-native';
const App: React.FC = () => {
const onImpactPress = () => {
Haptics.impact('heavy');
};
return (
<SafeAreaView style={styles.container}>
<TouchableOpacity style={styles.button} onPress={onImpactPress}>
<Text style={styles.buttonText}>Trigger Heavy Impact</Text>
</TouchableOpacity>
</SafeAreaView>
);
};
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
button: {
padding: 12.5,
borderRadius: 5,
backgroundColor: 'skyblue',
},
buttonText: {
fontSize: 22,
fontWeight: '600',
},
});What's next?
- Impact, Notification, and Selection feedback.
- Android-specific effects — a wide range of native Android vibration effects.
- Benchmarks — measured performance versus
expo-haptics.