Skip to content

fix: keep the player alive while a view is off-window - #82

Merged
theashraf merged 2 commits into
mainfrom
fix/no-reload-on-scroll-back
Jul 30, 2026
Merged

fix: keep the player alive while a view is off-window#82
theashraf merged 2 commits into
mainfrom
fix/no-reload-on-scroll-back

Conversation

@theashraf

Copy link
Copy Markdown
Member

Leaving the window was treated as a teardown, so list recycling and screen transitions destroyed the player and rebuilt it on the way back — re-reading the source (re-fetching it, for remote URLs) and restarting from frame 0. Playback now freezes at the current frame and resumes on return; the player is released only on unmount.

Verified on an emulator and a simulator with a 12-row list: previously iOS reloaded all 12 rows per scroll cycle and Android 9; now zero. Mount/unmount teardown still runs (checked via a temporary deinit probe on iOS).

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cec4ec0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lottiefiles/dotlottie-react-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

If unFreeze() threw, the flag was already cleared, so the view forgot it
owed a resume: the next detach saw a non-playing player and never
re-armed, leaving the animation frozen for good. Clearing on success
keeps the retry on the next re-attach and matches freezeWhileDetached().
@theashraf
theashraf force-pushed the fix/no-reload-on-scroll-back branch from fe4827e to cec4ec0 Compare July 30, 2026 07:46
@theashraf
theashraf merged commit f01081c into main Jul 30, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
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.

2 participants