Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/christianbaroni/react-native-turbo-haptics

Fast, worklet-compatible haptic feedback for React Native 🌀
https://github.com/christianbaroni/react-native-turbo-haptics

android haptic-feedback haptics ios react-native reanimated worklets

Last synced: 3 days ago
JSON representation

Fast, worklet-compatible haptic feedback for React Native 🌀

Awesome Lists containing this project

README

        

# 🌀 Turbo Haptics

Fast, **worklet-compatible** haptic feedback for React Native.

## Features

- 🏎ïļ Zero-delay haptic feedback, powered by JSI
- 🊄 Compatible with Reanimated and Gesture Handler worklets
- ðŸŽŊ 9 different haptic patterns (impact, notification, selection)
- ðŸ“ą iOS and Android support
- ðŸŠķ Lightweight, zero dependencies

## Installation

```sh
yarn add react-native-turbo-haptics
cd ios && pod install
```

## Usage

```ts
import { triggerHaptics } from 'react-native-turbo-haptics';

// In any JavaScript context:
triggerHaptics('selection');

// In worklets:
Gesture.Tap()
.onBegin(() => triggerHaptics('soft'));
```

```ts
// Available haptic types:
const HapticTypes = {
impactHeavy: 'impactHeavy',
impactLight: 'impactLight',
impactMedium: 'impactMedium',
notificationError: 'notificationError',
notificationSuccess: 'notificationSuccess',
notificationWarning: 'notificationWarning',
rigid: 'rigid',
selection: 'selection',
soft: 'soft',
};
```

## License

MIT