◉RORK LABJP
●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first
Articles/Dev Tools
⬡ Dev Tools/2026-06-24Advanced

Building a Breathing-Paced Haptic for a Meditation App with CoreHaptics

Canned expo-haptics buzzes can't produce the swell of a breath. Here is how to call CoreHaptics continuous events and parameter curves from an Expo native module to build a haptic synced to 4-7-8 breathing, with working Swift and TypeScript code.

Rork577CoreHapticsExpo213Native ModuleIndie Dev39

✦ Premium Article

When I shipped a small meditation and breathing app, built as an indie developer, the on-screen circle would expand and contract slowly, yet nothing reached the fingertips. People use this kind of app with their eyes closed, and I was guiding the breath with vision alone.

So I added expo-haptics and tried buzzing on the inhale and exhale cues. But Haptics.impactAsync() can only produce a single, instantaneous tap. What I wanted was a wave that swells over four seconds, pauses, and then fades over eight — something that rides along with the breath itself. No amount of stacking single taps gives you that continuous sensation.

The Taptic Engine in an iPhone is capable of far more nuance than that, and CoreHaptics is the API that unlocks it. Here we'll build a breath-synced haptic using CoreHaptics continuous events and parameter curves, then wrap it as an Expo native module so a React Native app (one generated with Rork) can call it — with the implementation code as we go.

Why expo-haptics alone never becomes a breath

expo-haptics exposes two broad families: the impact feedback of impactAsync(style) (light / medium / heavy) and the success/warning/error cues of notificationAsync(type). Both are designed to fire a single, very short, predefined pattern once.

A breathing wave needs something different in kind. What's missing comes down to three things:

  1. Duration — a continuous vibration that lasts several uninterrupted seconds
  2. A changing strength — the intensity rising and falling smoothly within those seconds
  3. Phase control — being able to specify the inhale, hold, and exhale phases in seconds

expo-haptics offers none of these. Scheduling presets with setTimeout leaves silent gaps between them, so you get a dotted line instead of a wave. To let someone feel the breath in their fingertips, you have to design the vibration as a continuous event and move its strength along a curve over time. That is exactly what CoreHaptics does.

What you wantexpo-hapticsCoreHaptics
A momentary tapGreat at itPossible (transient event)
A multi-second continuous buzzNot possibleContinuous event
Smoothly varying strength over timeNot possibleParameter curve
Ease of adoptionA few linesNeeds a native module

So it isn't an either/or choice. The pragmatic path is to leave taps to expo-haptics and add only the breathing wave through CoreHaptics. That's the arrangement I settled on myself.

CoreHaptics continuous events and parameter curves

The key to expressing a breath with CoreHaptics is combining the continuous type of CHHapticEvent with CHHapticParameterCurve.

A continuous event lets you say "hold a vibration for this many seconds." A parameter curve then controls how the intensity moves over that span, described by control points. For the inhale, ramp from 0 up slowly; for the exhale, fall from the peak back down to 0. That curve is the breathing wave.

Both intensity and sharpness take values from 0.0 to 1.0. Lowering sharpness rounds off the edges, giving a soft, gentle buzz. In a meditation app, keeping sharpness around 0.3 removes the stabbing quality and lets the haptic blend into the breath.

Here is one cycle of 4-7-8 breathing — inhale 4s, hold 7s, exhale 8s — assembled in Swift.

import CoreHaptics
 
func makeBreathPattern(inhale: Double, hold: Double, exhale: Double) throws -> CHHapticPattern {
    let sharp = CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.3)
 
    // Inhale: continuous event ramping strength 0 -> 0.8
    let inhaleEvent = CHHapticEvent(
        eventType: .hapticContinuous,
        parameters: [
            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.8),
            sharp
        ],
        relativeTime: 0,
        duration: inhale)
 
    let inhaleCurve = CHHapticParameterCurve(
        parameterID: .hapticIntensityControl,
        controlPoints: [
            .init(relativeTime: 0,      value: 0.0),
            .init(relativeTime: inhale, value: 1.0)
        ],
        relativeTime: 0)
 
    // Exhale: continuous event falling 0.8 -> 0, offset by the hold
    let exhaleStart = inhale + hold
    let exhaleEvent = CHHapticEvent(
        eventType: .hapticContinuous,
        parameters: [
            CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.8),
            sharp
        ],
        relativeTime: exhaleStart,
        duration: exhale)
 
    let exhaleCurve = CHHapticParameterCurve(
        parameterID: .hapticIntensityControl,
        controlPoints: [
            .init(relativeTime: exhaleStart,          value: 1.0),
            .init(relativeTime: exhaleStart + exhale, value: 0.0)
        ],
        relativeTime: 0)
 
    // The 7s hold has no event at all -- silence is the "hold your breath" phase
    return try CHHapticPattern(
        events: [inhaleEvent, exhaleEvent],
        parameterCurves: [inhaleCurve, exhaleCurve])
}

The crucial move is placing no event during the hold. The silence itself becomes the experience of holding your breath. Wrap two continuous events — inhale and exhale — in intensity curves, and the outline of a breath appears under the fingertips.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦You can design a continuous haptic whose strength rises and falls over several seconds using CoreHaptics parameter curves — something expo-haptics simply cannot do
✦You'll wrap CHHapticEngine in an Expo Modules API (Swift) module so React can call it by passing inhale/hold/exhale seconds
✦You'll handle the four traps every production app hits: engine auto-stop, foreground resume, unsupported hardware, and Low Power Mode
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-08-14
Your lockfile's dev/prod split won't tell you which licenses your app must credit
A record of classifying every dependency in a production project to decide what belongs on an app's license screen, and where the copyleft findings and the actual shipped artifact turned out to disagree.
⬡ Dev Tools2026-10-07
Japanese Headings Won't Turn Bold on Android: How to Trace and Fix a fontWeight That Does Nothing
A troubleshooting note for Rork apps where headings look bold on iPhone but stay thin on Android. How to tell the symptoms apart, pick weights through fontFamily, and verify the fix.
⬡ Dev Tools2026-09-21
A build that stops with exit code 0 — the flag that silenced the log, and the check that let an empty file through
Two reports landed in the same week: eas build --local stopping with exit code 0 but produced no further output, and a zero-byte stub that never got embedded. Both came down to settings that reduce output. Here is how to audit your own scripts.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links