◉RORK LABJP
●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left
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.

Rork621CoreHapticsExpo237Native ModuleIndie Dev40

✦ 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 $10 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-11-19
New Wallpapers Showed Up Everywhere Except the Filters: Ship the Count and the Category Lists Together
I added 67 wallpapers in one batch. They appeared in the full list and in New, but not under a single category filter, because I had raised the ID limit and forgotten to ship the category lists. Here is a pre-bump check, a client-side way to spot silent fallbacks in an Expo app, and a post-release count against the origin.
⬡ Dev Tools2026-10-30
It runs in development but the iOS Release build dies on launch — checking whether a missing scheme is the cause
In an expo-router app, an app.json with no scheme can crash only the iOS Release build at launch. Why Debug and Android survive, the two ways to fix it, how to think about leaving the scheme out on purpose, and a pre-submission check.