Skip to content

fix(ios): replay loop animations when the app becomes active again - #67

Merged
janicduplessis merged 1 commit into
mainfrom
@janic/ios-loops-survive-background
Oct 15, 2026
Merged

janicduplessis merged 1 commit into
mainfrom
@janic/ios-loops-survive-background

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #66.

On iOS a looping animation stopped for good after the app went to the background and came back: the view sat at its resting value until it remounted. Core Animation drops a layer's animations while the app is backgrounded. The saved loop snapshots (_loopAnimations) were only replayed from didMoveToWindow, which doesn't run here because the view never leaves its window.

EaseView now replays its saved loops on UIApplicationDidBecomeActiveNotification, after dropping any the current props no longer ask for (same as the window path). UIApplicationWillEnterForegroundNotification is too early: animations added then were dropped again. reapplyLoopAnimations now skips keys that still have an animation, since becoming active also follows inactive-only interruptions (Control Center, system alerts) where nothing was removed; re-adding would only churn onTransitionEnd accounting.

Loops keep their phase: the snapshots carry an explicit beginTime, so a loop picks up where it would have been.

Test Plan

iOS simulator (iPhone 16 Pro, iOS 18.6, Debug), on the example's Loop → Pause / Resume marquee:

The new Issues → Issue #66 — Background loops screen (a spinner and a pulse) is for regression checks.

@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
react-native-ease Ignored Ignored Oct 15, 2026 11:26am UTC

Request Review

@janicduplessis
janicduplessis marked this pull request as ready for review October 15, 2026 15:08
@janicduplessis
janicduplessis merged commit ebd0cbc into main Oct 15, 2026
8 checks passed
@janicduplessis
janicduplessis deleted the @janic/ios-loops-survive-background branch October 15, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: looping animations stop after the app returns from the background

1 participant