Home / File/ ResponderEventPlugin-test.internal.js — react Source File

ResponderEventPlugin-test.internal.js — react Source File

Architecture documentation for ResponderEventPlugin-test.internal.js, a javascript file in the react codebase.

File javascript CompilerCore Gating 17 functions 2 classes

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.
 *
 * @emails react-core
 */

'use strict';

// This test is a hot mess. It heavily uses internals and relies on DOM even
// though the responder plugin is only used in React Native. Sadness ensues.
// The coverage is valuable though, so we will keep it for now.
const {HostComponent} = require('react-reconciler/src/ReactWorkTags');

let EventBatching;
let EventPluginUtils;
let ResponderEventPlugin;

const touch = function (nodeHandle, i) {
  return {target: nodeHandle, identifier: i};
};

function injectComponentTree(ComponentTree) {
  EventPluginUtils.setComponentTree(
    ComponentTree.getFiberCurrentPropsFromNode,
    ComponentTree.getInstanceFromNode,
    ComponentTree.getNodeFromInstance,
  );
}

/**
 * @param {NodeHandle} nodeHandle @see NodeHandle. Handle of target.
 * @param {Array<Touch>} touches All active touches.
 * @param {Array<Touch>} changedTouches Only the touches that have changed.
 * @return {TouchEvent} Model of a touch event that is compliant with responder
 * system plugin.
 */
const touchEvent = function (nodeHandle, touches, changedTouches) {
  return {
    target: nodeHandle,
    changedTouches: changedTouches,
    touches: touches,
  };
};

const subsequence = function (arr, indices) {
  const ret = [];
  for (let i = 0; i < indices.length; i++) {
    const index = indices[i];
    ret.push(arr[index]);
  }
  return ret;
};

const antiSubsequence = function (arr, indices) {
  const ret = [];
  for (let i = 0; i < arr.length; i++) {
    if (indices.indexOf(i) === -1) {
// ... (1435 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ResponderEventPlugin-test.internal.js do?
ResponderEventPlugin-test.internal.js is a source file in the react codebase, written in javascript. It belongs to the CompilerCore domain, Gating subdomain.
What functions are defined in ResponderEventPlugin-test.internal.js?
ResponderEventPlugin-test.internal.js defines 17 function(s): _touchConfig, antiSubsequence, deleteAllListeners, endConfig, getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance, injectComponentTree, moveConfig, oneEventLoopTestConfig, and 7 more.
Where is ResponderEventPlugin-test.internal.js in the architecture?
ResponderEventPlugin-test.internal.js is located at packages/react-native-renderer/src/__tests__/ResponderEventPlugin-test.internal.js (domain: CompilerCore, subdomain: Gating, directory: packages/react-native-renderer/src/__tests__).

Analyze Your Own Codebase

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

Try Supermodel Free