RORK LABJP
MAX — Rork Max is built on Claude Code and Claude Opus 4.6, generating native Swift apps directly instead of React NativeAPPLE — Rork Max targets the whole Apple ecosystem: iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and iMessageWORKFLOW — In practice, users settle into letting the AI scaffold while they rewrite the state management and data layer themselvesSEED — Rork raised a $15M seed led by Left Lane Capital in April, with Peak XV, True Ventures, and a16z Speedrun joiningPAPERLINE — Rork acquired app builder Paperline and says it will stay acquisitive to bring in engineering talentREVIEW — Three-month revisit reviews are growing, clarifying where the tool shines and where it doesn'tMAX — Rork Max is built on Claude Code and Claude Opus 4.6, generating native Swift apps directly instead of React NativeAPPLE — Rork Max targets the whole Apple ecosystem: iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and iMessageWORKFLOW — In practice, users settle into letting the AI scaffold while they rewrite the state management and data layer themselvesSEED — Rork raised a $15M seed led by Left Lane Capital in April, with Peak XV, True Ventures, and a16z Speedrun joiningPAPERLINE — Rork acquired app builder Paperline and says it will stay acquisitive to bring in engineering talentREVIEW — Three-month revisit reviews are growing, clarifying where the tool shines and where it doesn't
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.

Rork502React Native202Expo139Animation8Performance23

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-07-07
Laying Out Variable-Height Images in Two Columns: A Masonry Wallpaper Gallery in a Rork Expo App
From why numColumns cannot pack variable-aspect images cleanly, to a dependency-free column-balancing algorithm, to keeping virtualization with FlashList masonry and a pragmatic no-dependency fallback, building a wallpaper gallery with real code.
App Dev2026-07-05
Building a One-Time Code Field in Expo — SMS Autofill and Segmented Display Together
A six-digit verification screen looks trivial, but once you account for SMS autofill, pasting, and deleting one digit at a time, it needs real care. Here is how to nail the iOS and Android autofill first, then build a segmented look on top of a single TextInput that does not break.
App Dev2026-06-27
Before You Ask 'Are You Sure?' — Consider an Undoable Delete
Showing a confirmation dialog every time someone removes a list item trains them to tap OK without reading. Here is how to build an undoable delete in a Rork (Expo) app, and where confirmation dialogs still belong.
📚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 →