RORK LABJP
BUILD — Rork Max runs real Macs in the cloud loaded with Xcode and the iOS SDK, writing SwiftUI, compiling, reading the errors and building again. That loop, not the code generation, is what lifts the outputNATIVE — What comes out is pure Swift and SwiftUI, not React Native. Reaching AR, Metal graphics and widgets that React Native cannot touch is the real gap between this and other buildersPLATFORMS — Coverage spans iPhone, iPad, Apple Watch, Apple TV and Vision Pro, plus iMessage. Worth a look if you want to start from a watch app or an extension rather than a phone screenCOMPANION — The Rork Companion app lets you check a generated build on a real iPhone without a paid Apple Developer account, lowering the bar for trying a first project end to endPRICING — Free to start, paid plans from $25 a month, and Rork Max on the $200 Max plan. Worth working out up front how many projects it takes to earn that backDEADLINE — From August 31, 2026, Google Play requires target API level 36 or higher for new apps and updates alike. Ten days out, and the targetSdkVersion of what you generate is yours to verifyBUILD — Rork Max runs real Macs in the cloud loaded with Xcode and the iOS SDK, writing SwiftUI, compiling, reading the errors and building again. That loop, not the code generation, is what lifts the outputNATIVE — What comes out is pure Swift and SwiftUI, not React Native. Reaching AR, Metal graphics and widgets that React Native cannot touch is the real gap between this and other buildersPLATFORMS — Coverage spans iPhone, iPad, Apple Watch, Apple TV and Vision Pro, plus iMessage. Worth a look if you want to start from a watch app or an extension rather than a phone screenCOMPANION — The Rork Companion app lets you check a generated build on a real iPhone without a paid Apple Developer account, lowering the bar for trying a first project end to endPRICING — Free to start, paid plans from $25 a month, and Rork Max on the $200 Max plan. Worth working out up front how many projects it takes to earn that backDEADLINE — From August 31, 2026, Google Play requires target API level 36 or higher for new apps and updates alike. Ten days out, and the targetSdkVersion of what you generate is yours to verify
Articles/App Dev
App Dev/2026-06-27Intermediate

Your Animation Keeps Running After You Leave the Screen — Focus-Aware Battery Savings in a Rork (Expo) App

In a Rork-generated Expo app, a gradient or breathing animation can keep running after you push another screen or background the app, quietly draining the battery without ever surfacing as jank. The cause is that Reanimated's withRepeat lives on the UI thread and the navigation stack keeps screens mounted. This shows a lifecycle design — useIsFocused plus AppState — that reliably stops off-screen and background loops, with working code.

Rork539React Native227Expo175Animation8Performance25

Premium Article

While building a "breathing guide" for one of my calming apps, I added a slow gradient that gently expanded and contracted. I liked the look. Then one evening, after carrying a beta build around all day, the device felt faintly warm, and the battery breakdown put this app surprisingly high under "background activity."

What puzzled me was that it never showed up as jank. Scrolling was smooth and nothing felt wrong. Yet the breathing animation kept expanding and contracting on the UI thread even after I pushed into Settings, even after I returned home and locked the phone. A silent loop running where I couldn't see it — that was what drained the battery.

After running several wallpaper and calming apps as an indie developer, the lesson I keep relearning is that when an animation stops matters more for battery than how heavy it is. Here I'll share a lifecycle design, using a Rork-generated Expo app as the example, that reliably stops off-screen and background loops.

Why animations don't stop when you leave the screen

It's counterintuitive, but pushing another screen does not stop your animation. There are two reasons.

First, a React Navigation stack does not unmount the previous screen — it keeps it mounted. When you push a detail screen, the list screen beneath it is still alive, and any withRepeat loop there keeps spinning. Tab navigators are even more pronounced: switching tabs generally leaves every tab's screen mounted.

Second, Reanimated's withRepeat runs on the UI thread (in a worklet). Even when the JavaScript thread stops rendering, the UI-thread animation advances independently. That independence is what makes it smooth — but the flip side is that it keeps running in a place JS can't see.

And critically, this never registers as jank. A dropped frame means rendering couldn't keep up; this problem is the opposite — rendering is keeping up, faithfully drawing frames for a screen nobody is looking at. It won't appear in a profiler's hitch view; it only accumulates, quietly, in the Energy Log.

Does each technique auto-stop off-screen?

Before designing the stop logic, it speeds up your decisions to know whether the animation techniques your app uses stop on their own off-screen or not.

TechniqueAuto-stops off-screenHow to stop it
Reanimated withRepeatNoCall cancelAnimation explicitly
Animated (RN core) loopNoHold the ref and call .stop()
Lottie (lottie-react-native)NoCall pause() on the ref / drop autoPlay
expo-video / expo-avNoCall the player's pause()
CSS-style infinite loop (WebView)DependsStop or hide the WebView
Loop inside a FlatList cellPartly, via virtualizationGate per-cell on visibility

The takeaway is that most techniques don't stop unless you stop them. Only FlatList virtualization unmounts off-screen cells for you — but headers and parallax layers sit outside virtualization, so they're the exception.

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
Understand why withRepeat loops, Lottie, and video keep running off-screen — the navigation stack stays mounted and the UI thread runs independently — and stop them reliably by combining useIsFocused with AppState
Get the reset step that prevents cancelAnimation from freezing a value mid-way, plus the useFocusEffect cleanup pattern that avoids double-starting a loop
Know, per animation technique, whether it auto-stops off-screen, so you can target only the always-on loops — breathing animations and wallpaper previews — for pausing
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

App Dev2026-08-16
My chart broke on day one, not at scale
A line chart that vanished for anyone with only a few days of data. The cause was a zero-height Y axis turning coordinates into NaN. Here is the measured behavior and the small normalization layer that fixed it.
App Dev2026-08-06
Deciding overlay text legibility at ingest time instead of on device — four metrics measured side by side
Moving the question of whether text stays readable over a wallpaper out of the device and into the content pipeline. Four candidate metrics measured across 240 images, including what downscaled judging actually computes.
App Dev2026-07-14
Long-Press Context Menus for a Gallery Item in a Rork Expo App
Long-pressing a wallpaper card does nothing, yet iOS users expect a preview and a menu. From why Pressable alone falls short, to a native context menu with zeego, resolving the scroll-vs-long-press conflict, wiring up save and share, and a custom overlay fallback for Android — all with working code.
📚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
See all →