Home / File/ ResponderTouchHistoryStore.js — react Source File

ResponderTouchHistoryStore.js — react Source File

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

File javascript BabelCompiler 4 imports 1 dependents

Entity Profile

Dependency Diagram

graph LR
  9ad2f0e1_d59b_817a_da0e_0e75838ea57c["ResponderTouchHistoryStore.js"]
  286a851e_063c_46bb_a363_9c8b89aa0e3e["ResponderTopLevelEventTypes.js"]
  9ad2f0e1_d59b_817a_da0e_0e75838ea57c --> 286a851e_063c_46bb_a363_9c8b89aa0e3e
  60f92383_40f2_196e_b450_7c99b0331648["isStartish"]
  9ad2f0e1_d59b_817a_da0e_0e75838ea57c --> 60f92383_40f2_196e_b450_7c99b0331648
  d2f15c72_7981_85cf_294a_267ee76fc3ed["isMoveish"]
  9ad2f0e1_d59b_817a_da0e_0e75838ea57c --> d2f15c72_7981_85cf_294a_267ee76fc3ed
  618ba80e_464a_e399_d48b_22dc1da5acb0["isEndish"]
  9ad2f0e1_d59b_817a_da0e_0e75838ea57c --> 618ba80e_464a_e399_d48b_22dc1da5acb0
  674c6180_b91e_e17d_fb2d_40a6a3631bb3["ResponderEventPlugin.js"]
  674c6180_b91e_e17d_fb2d_40a6a3631bb3 --> 9ad2f0e1_d59b_817a_da0e_0e75838ea57c
  style 9ad2f0e1_d59b_817a_da0e_0e75838ea57c 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 {isStartish, isMoveish, isEndish} from './ResponderTopLevelEventTypes';

/**
 * Tracks the position and time of each active touch by `touch.identifier`. We
 * should typically only see IDs in the range of 1-20 because IDs get recycled
 * when touches end and start again.
 */
type TouchRecord = {
  touchActive: boolean,
  startPageX: number,
  startPageY: number,
  startTimeStamp: number,
  currentPageX: number,
  currentPageY: number,
  currentTimeStamp: number,
  previousPageX: number,
  previousPageY: number,
  previousTimeStamp: number,
};

const MAX_TOUCH_BANK = 20;
const touchBank: Array<TouchRecord> = [];
const touchHistory = {
  touchBank,
  numberActiveTouches: 0,
  // If there is only one active touch, we remember its location. This prevents
  // us having to loop through all of the touches all the time in the most
  // common case.
  indexOfSingleActiveTouch: -1,
  mostRecentTimeStamp: 0,
};

type Touch = {
  identifier: ?number,
  pageX: number,
  pageY: number,
  timestamp: number,
  ...
};
type TouchEvent = {
  changedTouches: Array<Touch>,
  touches: Array<Touch>,
  ...
};

function timestampForTouch(touch: Touch): number {
  // The legacy internal implementation provides "timeStamp", which has been
  // renamed to "timestamp". Let both work for now while we iron it out
  // TODO (evv): rename timeStamp to timestamp in internal code
  return (touch: any).timeStamp || touch.timestamp;
}
// ... (178 more lines)

Domain

Frequently Asked Questions

What does ResponderTouchHistoryStore.js do?
ResponderTouchHistoryStore.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ResponderTouchHistoryStore.js depend on?
ResponderTouchHistoryStore.js imports 4 module(s): ResponderTopLevelEventTypes.js, isEndish, isMoveish, isStartish.
What files import ResponderTouchHistoryStore.js?
ResponderTouchHistoryStore.js is imported by 1 file(s): ResponderEventPlugin.js.
Where is ResponderTouchHistoryStore.js in the architecture?
ResponderTouchHistoryStore.js is located at packages/react-native-renderer/src/legacy-events/ResponderTouchHistoryStore.js (domain: BabelCompiler, directory: packages/react-native-renderer/src/legacy-events).

Analyze Your Own Codebase

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

Try Supermodel Free