New Feature

Native Haptics

A lightweight, zero-dependency implementation of haptic feedback using direct native code.

Zero Dependencies

No massive npm packages. Just pure, clean native code for iOS and Android.

Platform Native

Uses `UIImpactFeedbackGenerator` on iOS and `Vibrator` API on Android.

Type Safe

Full TypeScript support with easy-to-use helper functions.

Installation

Manual Setup
1

Get the Code

Go to the component page and copy the source files.

View Source Code
2

Add to Project

Copy the files to their respective locations locally:

  • `NativeHaptics.ts` → `src/utils/` or `components/`
  • iOS Files (`.swift`, `.m`) → `ios/YourApp/`
  • Android Files (`.kt`) → `android/app/src/main/java/...`

Usage

How to use
import { triggerSelectionHaptic, triggerImpact } from './NativeHaptics';

// Use on button press
const handlePress = () => {
    triggerSelectionHaptic(); // Light tap
    // perform action...
};

// Use for success feedback
const onSuccess = () => {
    triggerImpact('heavy'); // Heavy impact
};