Consolidate shared element transition state and hidden view tracking
Author: coderabbitai[bot]Created Sep 16, 2026Updated Sep 16, 2026
LabelsMissing reproMissing infoMaintainer issue
Summary
Consolidate the shared-element-transition state model.
The current implementation stores hidden view tags in a global hiddenViewTags_ set. This state is not tied to transition state in sharedContainers_. The current sharedContainers_ model stores only before and after nodes. It may not correctly represent sequential shared-element transitions such as A→B→C.
Required changes
- Define shared-transition state that associates hidden views with the relevant shared container or transition lifecycle.
- Update the state model so that sequential transitions, including A→B→C, preserve the required view state and restore each view at the correct time.
- Consolidate ownership, cleanup, and restoration of hidden-view state with shared-transition state.
- Resolve the TODO in
packages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cppat Line 42.
Rationale
A global hidden-view set can become detached from the transition that hides or restores a view. A transition-scoped state model should make cleanup and restoration explicit and support chained transitions.
Affected areas
packages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.*packages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpppackages/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp
Acceptance criteria
- Hidden-view state has an explicit association with its shared transition or shared container.
- A sequential A→B→C shared-element transition does not leave an incorrect source copy visible.
- Views restore only when their associated transition completes or is cleaned up.
- The TODO at Line 42 in
LayoutAnimationsManager.cppis resolved. - The shared-transition example is verified on iOS and Android.
Backlinks
- Pull request: https://github.com/software-mansion/react-native-reanimated/pull/10425
- Review comment: https://github.com/software-mansion/react-native-reanimated/pull/10425#pullrequestreview-5223227601
- Requested by: @pawicao
Source: software-mansion/react-native-reanimated