Home / File/ ReactNativeComponentTree.js — react Source File

ReactNativeComponentTree.js — react Source File

Architecture documentation for ReactNativeComponentTree.js, a javascript file in the react codebase. 0 imports, 4 dependents.

File javascript BabelCompiler Validation 4 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  6558eedc_539e_2a0a_77c0_574f399b3f4a["ReactNativeComponentTree.js"]
  3d20f780_732d_dfbf_ddf9_cb13ba9949a1["ReactFiberConfigNative.js"]
  3d20f780_732d_dfbf_ddf9_cb13ba9949a1 --> 6558eedc_539e_2a0a_77c0_574f399b3f4a
  baab5855_112a_37e6_6ca7_0813fd6ae027["ReactNativeEventEmitter.js"]
  baab5855_112a_37e6_6ca7_0813fd6ae027 --> 6558eedc_539e_2a0a_77c0_574f399b3f4a
  b96e6f5e_b1ed_ae54_d2fa_ae1632468aa8["ReactNativeFiberInspector.js"]
  b96e6f5e_b1ed_ae54_d2fa_ae1632468aa8 --> 6558eedc_539e_2a0a_77c0_574f399b3f4a
  dea78bbd_0d4e_27e7_3d5e_51bbb5d31b87["ReactNativeInjection.js"]
  dea78bbd_0d4e_27e7_3d5e_51bbb5d31b87 --> 6558eedc_539e_2a0a_77c0_574f399b3f4a
  style 6558eedc_539e_2a0a_77c0_574f399b3f4a 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.
 */

const instanceCache = new Map();
const instanceProps = new Map();

export function precacheFiberNode(hostInst, tag) {
  instanceCache.set(tag, hostInst);
}

export function uncacheFiberNode(tag) {
  instanceCache.delete(tag);
  instanceProps.delete(tag);
}

function getInstanceFromTag(tag) {
  return instanceCache.get(tag) || null;
}

function getTagFromInstance(inst) {
  let nativeInstance = inst.stateNode;
  let tag = nativeInstance._nativeTag;
  if (tag === undefined && nativeInstance.canonical != null) {
    // For compatibility with Fabric
    tag = nativeInstance.canonical.nativeTag;
    nativeInstance = nativeInstance.canonical.publicInstance;
  }

  if (!tag) {
    throw new Error('All native instances should have a tag.');
  }

  return nativeInstance;
}

export {
  getInstanceFromTag as getClosestInstanceFromNode,
  getInstanceFromTag as getInstanceFromNode,
  getTagFromInstance as getNodeFromInstance,
};

export function getFiberCurrentPropsFromNode(stateNode) {
  return instanceProps.get(stateNode._nativeTag) || null;
}

export function updateFiberProps(tag, props) {
  instanceProps.set(tag, props);
}

Domain

Subdomains

Frequently Asked Questions

What does ReactNativeComponentTree.js do?
ReactNativeComponentTree.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 ReactNativeComponentTree.js?
ReactNativeComponentTree.js defines 6 function(s): getFiberCurrentPropsFromNode, getInstanceFromTag, getTagFromInstance, precacheFiberNode, uncacheFiberNode, updateFiberProps.
What files import ReactNativeComponentTree.js?
ReactNativeComponentTree.js is imported by 4 file(s): ReactFiberConfigNative.js, ReactNativeEventEmitter.js, ReactNativeFiberInspector.js, ReactNativeInjection.js.
Where is ReactNativeComponentTree.js in the architecture?
ReactNativeComponentTree.js is located at packages/react-native-renderer/src/ReactNativeComponentTree.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-native-renderer/src).

Analyze Your Own Codebase

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

Try Supermodel Free