Home / File/ InitializeNativeFabricUIManager.js — react Source File

InitializeNativeFabricUIManager.js — react Source File

Architecture documentation for InitializeNativeFabricUIManager.js, a javascript file in the react codebase.

Entity Profile

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.
 */

'use strict';

// Mock of the Native Hooks

const roots = new Map();
const allocatedTags = new Set();

function dumpSubtree(info, indent) {
  let out = '';
  out += ' '.repeat(indent) + info.viewName + ' ' + JSON.stringify(info.props);
  // eslint-disable-next-line no-for-of-loops/no-for-of-loops
  for (const child of info.children) {
    out += '\n' + dumpSubtree(child, indent + 2);
  }
  return out;
}

const RCTFabricUIManager = {
  __dumpChildSetForJestTestsOnly: function (childSet) {
    const result = [];
    // eslint-disable-next-line no-for-of-loops/no-for-of-loops
    for (const child of childSet) {
      result.push(dumpSubtree(child, 0));
    }
    return result.join('\n');
  },
  __dumpHierarchyForJestTestsOnly: function () {
    const result = [];
    // eslint-disable-next-line no-for-of-loops/no-for-of-loops
    for (const [rootTag, childSet] of roots) {
      result.push(rootTag);
      // eslint-disable-next-line no-for-of-loops/no-for-of-loops
      for (const child of childSet) {
        result.push(dumpSubtree(child, 1));
      }
    }
    return result.join('\n');
  },
  createNode: jest.fn(
    function createNode(reactTag, viewName, rootTag, props, eventTarget) {
      if (allocatedTags.has(reactTag)) {
        throw new Error(`Created two native views with tag ${reactTag}`);
      }

      allocatedTags.add(reactTag);
      return {
        reactTag: reactTag,
        viewName: viewName,
        props: props,
        children: [],
      };
    },
  ),
// ... (153 more lines)

Domain

Subdomains

Frequently Asked Questions

What does InitializeNativeFabricUIManager.js do?
InitializeNativeFabricUIManager.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 InitializeNativeFabricUIManager.js?
InitializeNativeFabricUIManager.js defines 3 function(s): RCTFabricUIManager.__dumpChildSetForJestTestsOnly, RCTFabricUIManager.__dumpHierarchyForJestTestsOnly, dumpSubtree.
Where is InitializeNativeFabricUIManager.js in the architecture?
InitializeNativeFabricUIManager.js is located at packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate).

Analyze Your Own Codebase

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

Try Supermodel Free