Home / Function/ addTransitionType() — react Function Reference

addTransitionType() — react Function Reference

Architecture documentation for the addTransitionType() function in ReactTransitionType.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  adae78d5_cbb9_e89b_8efa_47511b87e1c0["addTransitionType()"]
  a822dcfc_4b5e_c5ea_05e7_3eae6016c82b["ReactTransitionType.js"]
  adae78d5_cbb9_e89b_8efa_47511b87e1c0 -->|defined in| a822dcfc_4b5e_c5ea_05e7_3eae6016c82b
  style adae78d5_cbb9_e89b_8efa_47511b87e1c0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react/src/ReactTransitionType.js lines 19–50

export function addTransitionType(type: string): void {
  if (enableViewTransition) {
    const transition = ReactSharedInternals.T;
    if (transition !== null) {
      const transitionTypes = transition.types;
      if (transitionTypes === null) {
        transition.types = [type];
      } else if (transitionTypes.indexOf(type) === -1) {
        transitionTypes.push(type);
      }
    } else {
      // We're in the async gap. Simulate an implicit startTransition around it.
      if (__DEV__) {
        if (ReactSharedInternals.asyncTransitions === 0) {
          if (enableGestureTransition) {
            console.error(
              'addTransitionType can only be called inside a `startTransition()` ' +
                'or `startGestureTransition()` callback. ' +
                'It must be associated with a specific Transition.',
            );
          } else {
            console.error(
              'addTransitionType can only be called inside a `startTransition()` ' +
                'callback. It must be associated with a specific Transition.',
            );
          }
        }
      }
      startTransition(addTransitionType.bind(null, type));
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does addTransitionType() do?
addTransitionType() is a function in the react codebase, defined in packages/react/src/ReactTransitionType.js.
Where is addTransitionType() defined?
addTransitionType() is defined in packages/react/src/ReactTransitionType.js at line 19.

Analyze Your Own Codebase

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

Try Supermodel Free