diff --git a/packages/events/TouchHistoryMath.js b/packages/events/TouchHistoryMath.js deleted file mode 100644 index 87ae368ec3f8c..0000000000000 --- a/packages/events/TouchHistoryMath.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Copyright (c) 2016-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -const TouchHistoryMath = { - /** - * This code is optimized and not intended to look beautiful. This allows - * computing of touch centroids that have moved after `touchesChangedAfter` - * timeStamp. You can compute the current centroid involving all touches - * moves after `touchesChangedAfter`, or you can compute the previous - * centroid of all touches that were moved after `touchesChangedAfter`. - * - * @param {TouchHistoryMath} touchHistory Standard Responder touch track - * data. - * @param {number} touchesChangedAfter timeStamp after which moved touches - * are considered "actively moving" - not just "active". - * @param {boolean} isXAxis Consider `x` dimension vs. `y` dimension. - * @param {boolean} ofCurrent Compute current centroid for actively moving - * touches vs. previous centroid of now actively moving touches. - * @return {number} value of centroid in specified dimension. - */ - centroidDimension: function( - touchHistory, - touchesChangedAfter, - isXAxis, - ofCurrent, - ) { - const touchBank = touchHistory.touchBank; - let total = 0; - let count = 0; - - const oneTouchData = - touchHistory.numberActiveTouches === 1 - ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch] - : null; - - if (oneTouchData !== null) { - if ( - oneTouchData.touchActive && - oneTouchData.currentTimeStamp > touchesChangedAfter - ) { - total += - ofCurrent && isXAxis - ? oneTouchData.currentPageX - : ofCurrent && !isXAxis - ? oneTouchData.currentPageY - : !ofCurrent && isXAxis - ? oneTouchData.previousPageX - : oneTouchData.previousPageY; - count = 1; - } - } else { - for (let i = 0; i < touchBank.length; i++) { - const touchTrack = touchBank[i]; - if ( - touchTrack !== null && - touchTrack !== undefined && - touchTrack.touchActive && - touchTrack.currentTimeStamp >= touchesChangedAfter - ) { - let toAdd; // Yuck, program temporarily in invalid state. - if (ofCurrent && isXAxis) { - toAdd = touchTrack.currentPageX; - } else if (ofCurrent && !isXAxis) { - toAdd = touchTrack.currentPageY; - } else if (!ofCurrent && isXAxis) { - toAdd = touchTrack.previousPageX; - } else { - toAdd = touchTrack.previousPageY; - } - total += toAdd; - count++; - } - } - } - return count > 0 ? total / count : TouchHistoryMath.noCentroid; - }, - - currentCentroidXOfTouchesChangedAfter: function( - touchHistory, - touchesChangedAfter, - ) { - return TouchHistoryMath.centroidDimension( - touchHistory, - touchesChangedAfter, - true, // isXAxis - true, // ofCurrent - ); - }, - - currentCentroidYOfTouchesChangedAfter: function( - touchHistory, - touchesChangedAfter, - ) { - return TouchHistoryMath.centroidDimension( - touchHistory, - touchesChangedAfter, - false, // isXAxis - true, // ofCurrent - ); - }, - - previousCentroidXOfTouchesChangedAfter: function( - touchHistory, - touchesChangedAfter, - ) { - return TouchHistoryMath.centroidDimension( - touchHistory, - touchesChangedAfter, - true, // isXAxis - false, // ofCurrent - ); - }, - - previousCentroidYOfTouchesChangedAfter: function( - touchHistory, - touchesChangedAfter, - ) { - return TouchHistoryMath.centroidDimension( - touchHistory, - touchesChangedAfter, - false, // isXAxis - false, // ofCurrent - ); - }, - - currentCentroidX: function(touchHistory) { - return TouchHistoryMath.centroidDimension( - touchHistory, - 0, // touchesChangedAfter - true, // isXAxis - true, // ofCurrent - ); - }, - - currentCentroidY: function(touchHistory) { - return TouchHistoryMath.centroidDimension( - touchHistory, - 0, // touchesChangedAfter - false, // isXAxis - true, // ofCurrent - ); - }, - - noCentroid: -1, -}; - -export default TouchHistoryMath; diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js index 3d60d0d48cb3c..0c2c5ed197127 100644 --- a/packages/react-native-renderer/src/ReactFabric.js +++ b/packages/react-native-renderer/src/ReactFabric.js @@ -14,7 +14,6 @@ import './ReactFabricInjection'; import * as ReactPortal from 'shared/ReactPortal'; import * as ReactGenericBatching from 'events/ReactGenericBatching'; -import TouchHistoryMath from 'events/TouchHistoryMath'; import ReactVersion from 'shared/ReactVersion'; import NativeMethodsMixin from './NativeMethodsMixin'; @@ -87,7 +86,6 @@ const ReactFabric: ReactNativeType = { ReactNativeBridgeEventPlugin, // requireNativeComponent ReactNativeComponentTree, // ScrollResponder ReactNativePropRegistry, // flattenStyle, Stylesheet - TouchHistoryMath, // PanResponder createReactNativeComponentClass, // RCTText, RCTView, ReactNativeART takeSnapshot, // react-native-implementation }, diff --git a/packages/react-native-renderer/src/ReactNativeRenderer.js b/packages/react-native-renderer/src/ReactNativeRenderer.js index a4fa8f707df0c..e6bdb7cdc5d27 100644 --- a/packages/react-native-renderer/src/ReactNativeRenderer.js +++ b/packages/react-native-renderer/src/ReactNativeRenderer.js @@ -14,7 +14,6 @@ import './ReactNativeInjection'; import * as ReactPortal from 'shared/ReactPortal'; import * as ReactGenericBatching from 'events/ReactGenericBatching'; -import TouchHistoryMath from 'events/TouchHistoryMath'; import ReactVersion from 'shared/ReactVersion'; // Module provided by RN: import UIManager from 'UIManager'; @@ -106,7 +105,6 @@ const ReactNativeRenderer: ReactNativeType = { ReactNativeBridgeEventPlugin, // requireNativeComponent ReactNativeComponentTree, // ScrollResponder ReactNativePropRegistry, // flattenStyle, Stylesheet - TouchHistoryMath, // PanResponder createReactNativeComponentClass, // RCTText, RCTView, ReactNativeART takeSnapshot, // react-native-implementation computeComponentStackForErrorReporting, diff --git a/scripts/rollup/shims/react-native/TouchHistoryMath.js b/scripts/rollup/shims/react-native/TouchHistoryMath.js deleted file mode 100644 index 75edb24a7209c..0000000000000 --- a/scripts/rollup/shims/react-native/TouchHistoryMath.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @providesModule TouchHistoryMath - */ - -'use strict'; - -const { - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, -} = require('ReactNative'); - -module.exports = - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.TouchHistoryMath;