Home / Function/ applyDepartureTransitions() — react Function Reference

applyDepartureTransitions() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  95eaf773_60ec_f268_4df8_d89eba60ce45["applyDepartureTransitions()"]
  ee850b36_fc0b_9bb2_5b69_58d705aef9a5["ReactFiberApplyGesture.js"]
  95eaf773_60ec_f268_4df8_d89eba60ce45 -->|defined in| ee850b36_fc0b_9bb2_5b69_58d705aef9a5
  5309a33c_225d_2870_d95a_89bdc6c62aa1["recursivelyApplyViewTransitions()"]
  95eaf773_60ec_f268_4df8_d89eba60ce45 -->|calls| 5309a33c_225d_2870_d95a_89bdc6c62aa1
  style 95eaf773_60ec_f268_4df8_d89eba60ce45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberApplyGesture.js lines 1222–1259

export function applyDepartureTransitions(
  root: FiberRoot,
  finishedWork: Fiber,
): void {
  // First measure and apply view-transition-names to the "new" states.
  viewTransitionContextChanged = false;
  pushViewTransitionCancelableScope();

  recursivelyApplyViewTransitions(finishedWork);

  // Then remove the clones.
  const rootClone = root.gestureClone;
  if (rootClone !== null) {
    root.gestureClone = null;
    removeRootViewTransitionClone(root.containerInfo, rootClone);
  }

  if (!viewTransitionContextChanged) {
    // If we didn't leak any resizing out to the root, we don't have to transition
    // the root itself. This means that we can now safely cancel any cancellations
    // that bubbled all the way up.
    const cancelableChildren = viewTransitionCancelableChildren;
    if (cancelableChildren !== null) {
      for (let i = 0; i < cancelableChildren.length; i += 3) {
        cancelViewTransitionName(
          ((cancelableChildren[i]: any): Instance),
          ((cancelableChildren[i + 1]: any): string),
          ((cancelableChildren[i + 2]: any): Props),
        );
      }
    }
    // We also cancel the root itself. First we restore the name to the documentElement
    // and then we cancel it.
    restoreRootViewTransitionName(root.containerInfo);
    cancelRootViewTransitionName(root.containerInfo);
  }
  popViewTransitionCancelableScope(null);
}

Domain

Subdomains

Frequently Asked Questions

What does applyDepartureTransitions() do?
applyDepartureTransitions() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberApplyGesture.js.
Where is applyDepartureTransitions() defined?
applyDepartureTransitions() is defined in packages/react-reconciler/src/ReactFiberApplyGesture.js at line 1222.
What does applyDepartureTransitions() call?
applyDepartureTransitions() calls 1 function(s): recursivelyApplyViewTransitions.

Analyze Your Own Codebase

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

Try Supermodel Free