npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

expo-custom-haptics

v1.0.1

Published

React Native module for loading and interacting with Apple ahap files (Fork of expo-ahap)

Downloads

10

Readme

🎮 expo-custom-haptics

A powerful React Native module for creating rich, customizable haptic experiences with Apple AHAP files. Originally forked from expo-ahap, now maintained and maintained by the Equals team.

✨ Features

  • Full implementation of Apple's Haptic Pattern API
  • Support for complex haptic patterns and sequences
  • Over-the-air (OTA) audio file integration
  • iOS 13+ compatibility
  • TypeScript support

🛠 Installation

npm install expo-custom-haptics
# or
yarn add expo-custom-haptics

⚠️ Important: This module requires a physical iOS device running iOS 13 or greater. Run with: npx expo run:ios -d

🎯 Quick Start

import { Player } from "expo-custom-haptics";

const player = new Player({
  // Your AHAP pattern
});

player.start();

// Don't forget to clean up!
player.unregister();

🎨 Create Custom Patterns

Design your own haptic patterns:

📱 Example

Here's a sample that creates a satisfying "brrrp!" sensation:

import { StyleSheet, Text, View } from "react-native";
import { Player } from "expo-custom-haptics";

const player = new Player({
  Pattern: [
    {
      Event: {
        Time: 0.0,
        EventType: "HapticContinuous",
        EventDuration: 0.6,
        EventParameters: [
          { ParameterID: "HapticIntensity", ParameterValue: 1.0 },
          { ParameterID: "HapticSharpness", ParameterValue: 0.5 },
        ],
      },
    },
    {
      ParameterCurve: {
        ParameterID: "HapticIntensityControl",
        Time: 0.0,
        ParameterCurveControlPoints: [
          { Time: 0, ParameterValue: 0.2 },
          { Time: 0.6, ParameterValue: 0.7 },
          { Time: 0.601, ParameterValue: 1.0 },
        ],
      },
    },
    {
      ParameterCurve: {
        ParameterID: "HapticSharpnessControl",
        Time: 0.0,
        ParameterCurveControlPoints: [
          { Time: 0, ParameterValue: -0.5 },
          { Time: 0.6, ParameterValue: 0.5 },
        ],
      },
    },

    {
      Event: {
        Time: 0.601,
        EventType: "HapticTransient",
        EventParameters: [
          { ParameterID: "HapticIntensity", ParameterValue: 1.0 },
          { ParameterID: "HapticSharpness", ParameterValue: 0.7 },
        ],
      },
    },
  ],
});

export default function App() {
  return (
    <View style={styles.container}>
      <Text onPress={() => player.start()}>Feel the magic! ✨</Text>
    </View>
  );
}

🎵 Audio Integration

Integrate audio files with two methods:

1. OTA Audio Loading

import React from "react";
import * as FS from "expo-file-system";
import { Asset } from "expo-asset";

function useAudioInDocumentsDir(res) {
  const [audioName, setName] = React.useState<string | null>(null);

  React.useEffect(() => {
    Asset.fromModule(res)
      .downloadAsync()
      .then(async (result) => {
        const audioName = result.localUri.split("/").pop();
        // move to the ios folder
        await FS.copyAsync({
          from: result.localUri,
          to: FS.documentDirectory + audioName,
        });

        setName(audioName);
      });
  }, [res]);

  return audioName;
}

2. Binary Asset Loading

Use the link-assets config plugin to bundle audio directly in your app binary.

💪 Support

Maintained with ❤️ by the Equals team. If you encounter any issues or have feature requests, please open an issue on our GitHub repository.

📄 License

ISC License