react-native-pulsar
v1.0.2
Published
Rich and ready-to-use haptics library
Readme
A haptic feedback SDK for React Native. Pulsar provides ready-to-use haptic presets, a pattern composer for custom haptic sequences, and a real-time composer for gesture-driven feedback.
Features
- Presets - Library of built-in haptic patterns (earthquake, success, fail, tap) and system feedback styles (impacts, notifications, selection)
- Pattern Composer - Define custom haptic patterns using discrete events and continuous amplitude/frequency envelopes
- Realtime Composer - Live amplitude and frequency control for gesture-driven haptics
- Cross-platform - Consistent API across iOS (Swift), Android (Kotlin), and React Native (TypeScript)
- Worklet-compatible - All React Native preset functions and hook methods work inside Reanimated worklets
Quick start
Installation
npx expo install react-native-pulsar react-native-workletsPreset example
import { Presets } from 'react-native-pulsar';
// Play a preset
Presets.hammer();
// Play a system haptic
Presets.System.impactMedium();usePatternComposer example
import { usePatternComposer } from 'react-native-pulsar';
const pattern = {
discretePattern: [
{ time: 0, amplitude: 1, frequency: 0.5 },
{ time: 100, amplitude: 0.5, frequency: 0.5 },
],
continuousPattern: {
amplitude: [
{ time: 0, value: 0 },
{ time: 200, value: 1 },
{ time: 400, value: 0 },
],
frequency: [
{ time: 0, value: 0.3 },
{ time: 400, value: 0.8 },
],
},
};
const { play } = usePatternComposer(pattern);
play();useRealtimeComposer example
import { useRealtimeComposer } from 'react-native-pulsar';
const { set, stop } = useRealtimeComposer();
set(0.7, 0.5);
stop();Documentation
Full API reference and guides are available at the documentation site.
- SDK Overview - Core concepts: types of haptics, preloading, and caching
- React Native SDK - TypeScript API reference
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
Pulsar library is licensed under The MIT License.
Try the Pulsar App
Download the Pulsar companion app to feel haptic presets directly on your device:
Community Discord
Join the Software Mansion Community Discord to chat about haptics or other Software Mansion libraries.
Pulsar is created by Software Mansion
Since 2012 Software Mansion is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – Hire us.
