@hapticjs/react-native
v0.1.0
Published
React Native adapter for Feelback haptic engine
Downloads
72
Maintainers
Readme
@hapticjs/react-native
React Native adapter for the @hapticjs haptic engine.
npm install @hapticjs/react-native @hapticjs/coreBackends
Automatically detects and uses the best available haptic backend:
- react-native-haptic-feedback (preferred) — rich haptic types on iOS/Android
- expo-haptics — Expo-compatible haptics
- React Native Vibration — basic vibration fallback
Install at least one:
npm install react-native-haptic-feedback
# or
npx expo install expo-hapticsUsage
import { useHaptic } from '@hapticjs/react-native';
// With a preset
function LikeButton() {
const { trigger, isSupported } = useHaptic('success');
return <Pressable onPress={trigger}><Text>Like</Text></Pressable>;
}
// Full API
function App() {
const haptic = useHaptic();
return (
<Pressable onPress={() => haptic.tap()}>
<Text>Tap me</Text>
</Pressable>
);
}License
MIT
