Home / File/ ReactTransitionType.js — react Source File

ReactTransitionType.js — react Source File

Architecture documentation for ReactTransitionType.js, a javascript file in the react codebase. 3 imports, 2 dependents.

File javascript BabelCompiler Validation 3 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  a822dcfc_4b5e_c5ea_05e7_3eae6016c82b["ReactTransitionType.js"]
  6c1a4807_17b9_f103_ac9c_f90f16c710be["ReactStartTransition.js"]
  a822dcfc_4b5e_c5ea_05e7_3eae6016c82b --> 6c1a4807_17b9_f103_ac9c_f90f16c710be
  1c5695a6_6806_ba54_2074_efc779e66da4["ReactSharedInternals"]
  a822dcfc_4b5e_c5ea_05e7_3eae6016c82b --> 1c5695a6_6806_ba54_2074_efc779e66da4
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  a822dcfc_4b5e_c5ea_05e7_3eae6016c82b --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  ffdf54f0_7e34_f1e9_1504_9dbadb0fbac5["ReactClient.js"]
  ffdf54f0_7e34_f1e9_1504_9dbadb0fbac5 --> a822dcfc_4b5e_c5ea_05e7_3eae6016c82b
  6c1a4807_17b9_f103_ac9c_f90f16c710be["ReactStartTransition.js"]
  6c1a4807_17b9_f103_ac9c_f90f16c710be --> a822dcfc_4b5e_c5ea_05e7_3eae6016c82b
  style a822dcfc_4b5e_c5ea_05e7_3eae6016c82b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import ReactSharedInternals from 'shared/ReactSharedInternals';
import {
  enableViewTransition,
  enableGestureTransition,
} from 'shared/ReactFeatureFlags';
import {startTransition} from './ReactStartTransition';

export type TransitionTypes = Array<string>;

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

Dependencies

Frequently Asked Questions

What does ReactTransitionType.js do?
ReactTransitionType.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactTransitionType.js?
ReactTransitionType.js defines 1 function(s): addTransitionType.
What does ReactTransitionType.js depend on?
ReactTransitionType.js imports 3 module(s): ReactFeatureFlags, ReactSharedInternals, ReactStartTransition.js.
What files import ReactTransitionType.js?
ReactTransitionType.js is imported by 2 file(s): ReactClient.js, ReactStartTransition.js.
Where is ReactTransitionType.js in the architecture?
ReactTransitionType.js is located at packages/react/src/ReactTransitionType.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src).

Analyze Your Own Codebase

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

Try Supermodel Free