Home / Function/ trackEnterViewTransitions() — react Function Reference

trackEnterViewTransitions() — react Function Reference

Architecture documentation for the trackEnterViewTransitions() function in ReactFiberApplyGesture.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5b137679_4a8b_3936_c79e_3b332f503824["trackEnterViewTransitions()"]
  1018fb0f_66a4_cdd8_25b9_d3808a6cac4b["ReactFiberApplyGesture.js"]
  5b137679_4a8b_3936_c79e_3b332f503824 -->|defined in| 1018fb0f_66a4_cdd8_25b9_d3808a6cac4b
  eda80bd9_6137_8dce_2f0f_a1cefeb95e7b["recursivelyInsertClones()"]
  eda80bd9_6137_8dce_2f0f_a1cefeb95e7b -->|calls| 5b137679_4a8b_3936_c79e_3b332f503824
  8e6c1a98_8e68_d976_3cd9_8b9c94bf0990["insertDestinationClonesOfFiber()"]
  8e6c1a98_8e68_d976_3cd9_8b9c94bf0990 -->|calls| 5b137679_4a8b_3936_c79e_3b332f503824
  c68aa7f2_7280_9018_61b9_5ebf575d45c4["trackEnterViewTransitions()"]
  5b137679_4a8b_3936_c79e_3b332f503824 -->|calls| c68aa7f2_7280_9018_61b9_5ebf575d45c4
  06c1533c_ea03_05d5_d4d5_2498142c15e4["getViewTransitionName()"]
  5b137679_4a8b_3936_c79e_3b332f503824 -->|calls| 06c1533c_ea03_05d5_d4d5_2498142c15e4
  8ea5b874_7be0_73e9_f80b_36406a0ee3f8["getViewTransitionClassName()"]
  5b137679_4a8b_3936_c79e_3b332f503824 -->|calls| 8ea5b874_7be0_73e9_f80b_36406a0ee3f8
  d79909bb_d127_6079_dff2_362f42d86dd8["applyViewTransitionToClones()"]
  5b137679_4a8b_3936_c79e_3b332f503824 -->|calls| d79909bb_d127_6079_dff2_362f42d86dd8
  0e876a39_72a8_fcb6_75b2_90cbacc4dd9e["trackDeletedPairViewTransitions()"]
  5b137679_4a8b_3936_c79e_3b332f503824 -->|calls| 0e876a39_72a8_fcb6_75b2_90cbacc4dd9e
  style 5b137679_4a8b_3936_c79e_3b332f503824 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberApplyGesture.js lines 213–263

function trackEnterViewTransitions(deletion: Fiber): void {
  if (deletion.tag === ViewTransitionComponent) {
    const props: ViewTransitionProps = deletion.memoizedProps;
    const name = getViewTransitionName(props, deletion.stateNode);
    const pair =
      appearingViewTransitions !== null
        ? appearingViewTransitions.get(name)
        : undefined;
    const className: ?string = getViewTransitionClassName(
      props.default,
      pair !== undefined ? props.share : props.enter,
    );
    if (className !== 'none') {
      if (pair !== undefined) {
        // TODO: Since the deleted instance already has layout we could
        // check if it's in the viewport and if not skip the pairing.
        // It would currently cause layout thrash though so if we did that
        // we need to avoid inserting the root of the cloned trees until
        // the end.

        // Delete the entry so that we know when we've found all of them
        // and can stop searching (size reaches zero).
        // $FlowFixMe[incompatible-use]: Refined by the pair.
        appearingViewTransitions.delete(name);
        // The "old" instance is actually the one we're inserting.
        const oldInstance: ViewTransitionState = pair;
        // The "new" instance is the already mounted one we're deleting.
        const newInstance: ViewTransitionState = deletion.stateNode;
        oldInstance.paired = newInstance;
        newInstance.paired = oldInstance;
        const clones = oldInstance.clones;
        if (clones !== null) {
          // If we have clones that means that we've already visited this
          // ViewTransition boundary before and we can now apply the name
          // to those clones. Otherwise, we have to wait until we clone it.
          applyViewTransitionToClones(name, className, clones, deletion);
        }
      }
    }
    // Look for more pairs deeper in the tree.
    trackDeletedPairViewTransitions(deletion);
  } else if ((deletion.subtreeFlags & ViewTransitionStatic) !== NoFlags) {
    let child = deletion.child;
    while (child !== null) {
      trackEnterViewTransitions(child);
      child = child.sibling;
    }
  } else {
    trackDeletedPairViewTransitions(deletion);
  }
}

Domain

Subdomains

Frequently Asked Questions

What does trackEnterViewTransitions() do?
trackEnterViewTransitions() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberApplyGesture.js.
Where is trackEnterViewTransitions() defined?
trackEnterViewTransitions() is defined in packages/react-reconciler/src/ReactFiberApplyGesture.js at line 213.
What does trackEnterViewTransitions() call?
trackEnterViewTransitions() calls 5 function(s): applyViewTransitionToClones, getViewTransitionClassName, getViewTransitionName, trackDeletedPairViewTransitions, trackEnterViewTransitions.
What calls trackEnterViewTransitions()?
trackEnterViewTransitions() is called by 2 function(s): insertDestinationClonesOfFiber, recursivelyInsertClones.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free