Skip to content

fix(iOS): clean up screen animation mount observers - #8355

Open
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/cleanup-screen-animation-observers
Open

fix(iOS): clean up screen animation mount observers#8355
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/cleanup-screen-animation-observers

Conversation

@OskarEichler

Copy link
Copy Markdown

Problem and fix

ScreenAnimationController registered itself for React Native mount notifications on every transition but never unregistered. Under the New Architecture, RCTSurfacePresenter stores observers in a weak vector whose dead entries are not compacted, so repeated navigation leaves an ever-growing list for every mount notification to scan.

This change:

  • registers only when a transition actually needs to wait for a React mount
  • makes observer registration idempotent
  • unregisters before starting the animation, when the transition ends or is cancelled, and during deallocation
  • covers the lifecycle with a regression test that verifies duplicate transitions register once and repeated cleanup removes once

The legacy RCTUIManagerObserverCoordinator path receives the same balanced lifecycle cleanup.

Verification

  • New Architecture iOS build-for-testing succeeded
  • ScreenAnimationControllerTest: 1/1 passed on an iPhone 16 Pro simulator (iOS 26.5)
  • project file validation passed
  • clang-format and git diff --check passed

Breaking changes

None. This only balances internal observer registration and removal.

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.

1 participant