mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
26 lines
641 B
JavaScript
26 lines
641 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its 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 type {
|
|
ReactResponderEvent,
|
|
ReactResponderContext,
|
|
} from 'shared/ReactTypes';
|
|
|
|
export function isEventPositionWithinTouchHitTarget(
|
|
event: ReactResponderEvent,
|
|
context: ReactResponderContext,
|
|
) {
|
|
const nativeEvent: any = event.nativeEvent;
|
|
return context.isPositionWithinTouchHitTarget(
|
|
// x and y can be doubles, so ensure they are integers
|
|
parseInt(nativeEvent.x, 10),
|
|
parseInt(nativeEvent.y, 10),
|
|
);
|
|
}
|