Home / File/ ReactNativeAttributePayload.js — react Source File

ReactNativeAttributePayload.js — react Source File

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

File javascript BabelCompiler Validation 3 imports 2 dependents 10 functions

Entity Profile

Dependency Diagram

graph LR
  3429d3f6_3e01_954f_bb31_157d6bedf858["ReactNativeAttributePayload.js"]
  24686b4c_3c4b_6fa0_b125_37d3286a1ff4["ReactNativeTypes.js"]
  3429d3f6_3e01_954f_bb31_157d6bedf858 --> 24686b4c_3c4b_6fa0_b125_37d3286a1ff4
  94a68304_3047_524d_e604_af34f5a80eaf["ReactNativePrivateInterface"]
  3429d3f6_3e01_954f_bb31_157d6bedf858 --> 94a68304_3047_524d_e604_af34f5a80eaf
  af78c51d_c7cb_3bf4_550f_f3fcc48f4f34["isArray"]
  3429d3f6_3e01_954f_bb31_157d6bedf858 --> af78c51d_c7cb_3bf4_550f_f3fcc48f4f34
  3d20f780_732d_dfbf_ddf9_cb13ba9949a1["ReactFiberConfigNative.js"]
  3d20f780_732d_dfbf_ddf9_cb13ba9949a1 --> 3429d3f6_3e01_954f_bb31_157d6bedf858
  f6a368ec_c652_2004_0c12_4c53a053a27c["ReactNativeFiberHostComponent.js"]
  f6a368ec_c652_2004_0c12_4c53a053a27c --> 3429d3f6_3e01_954f_bb31_157d6bedf858
  style 3429d3f6_3e01_954f_bb31_157d6bedf858 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
 */

// Modules provided by RN:
import {
  deepDiffer,
  flattenStyle,
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
import isArray from 'shared/isArray';

import type {AttributeConfiguration} from './ReactNativeTypes';

const emptyObject = {};

/**
 * Create a payload that contains all the updates between two sets of props.
 *
 * These helpers are all encapsulated into a single module, because they use
 * mutation as a performance optimization which leads to subtle shared
 * dependencies between the code paths. To avoid this mutable state leaking
 * across modules, I've kept them isolated to this module.
 */

type NestedNode = Array<NestedNode> | Object;

// Tracks removed keys
let removedKeys: {[string]: boolean} | null = null;
let removedKeyCount = 0;

const deepDifferOptions = {
  unsafelyIgnoreFunctions: true,
};

function defaultDiffer(prevProp: mixed, nextProp: mixed): boolean {
  if (typeof nextProp !== 'object' || nextProp === null) {
    // Scalars have already been checked for equality
    return true;
  } else {
    // For objects and arrays, the default diffing algorithm is a deep compare
    return deepDiffer(prevProp, nextProp, deepDifferOptions);
  }
}

function restoreDeletedValuesInNestedArray(
  updatePayload: Object,
  node: NestedNode,
  validAttributes: AttributeConfiguration,
) {
  if (isArray(node)) {
    let i = node.length;
    while (i-- && removedKeyCount > 0) {
      restoreDeletedValuesInNestedArray(
        updatePayload,
        node[i],
// ... (433 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ReactNativeAttributePayload.js do?
ReactNativeAttributePayload.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 ReactNativeAttributePayload.js?
ReactNativeAttributePayload.js defines 10 function(s): addNestedProperty, addProperties, clearNestedProperty, clearProperties, create, defaultDiffer, diff, diffNestedArrayProperty, diffProperties, restoreDeletedValuesInNestedArray.
What does ReactNativeAttributePayload.js depend on?
ReactNativeAttributePayload.js imports 3 module(s): ReactNativePrivateInterface, ReactNativeTypes.js, isArray.
What files import ReactNativeAttributePayload.js?
ReactNativeAttributePayload.js is imported by 2 file(s): ReactFiberConfigNative.js, ReactNativeFiberHostComponent.js.
Where is ReactNativeAttributePayload.js in the architecture?
ReactNativeAttributePayload.js is located at packages/react-native-renderer/src/ReactNativeAttributePayload.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