Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tamagui/react-native-use-responder-events

Package Overview
Dependencies
Maintainers
1
Versions
920
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tamagui/react-native-use-responder-events - npm Package Compare versions

Comparing version 1.0.1-rc.5.1 to 1.0.1-rc.6

14

dist/cjs/createResponderEvent.js

@@ -41,10 +41,8 @@ "use strict";

const shiftKey = domEvent.shiftKey === true;
const force = domEventChangedTouches && domEventChangedTouches[0].force || 0;
const identifier = normalizeIdentifier(
domEventChangedTouches && domEventChangedTouches[0].identifier || 0
);
const clientX = domEventChangedTouches && domEventChangedTouches[0].clientX || domEvent.clientX;
const clientY = domEventChangedTouches && domEventChangedTouches[0].clientY || domEvent.clientY;
const pageX = domEventChangedTouches && domEventChangedTouches[0].pageX || domEvent.pageX;
const pageY = domEventChangedTouches && domEventChangedTouches[0].pageY || domEvent.pageY;
const force = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].force) || 0;
const identifier = normalizeIdentifier((domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].identifier) || 0);
const clientX = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].clientX) || domEvent.clientX;
const clientY = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].clientY) || domEvent.clientY;
const pageX = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].pageX) || domEvent.pageX;
const pageY = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].pageY) || domEvent.pageY;
const preventDefault = typeof domEvent.preventDefault === "function" ? domEvent.preventDefault.bind(domEvent) : emptyFunction;

@@ -51,0 +49,0 @@ const timestamp = domEvent.timeStamp;

@@ -113,3 +113,6 @@ "use strict";

}
responderTouchHistoryStore.recordTouchTrack(eventType, responderEvent.nativeEvent);
responderTouchHistoryStore.recordTouchTrack(
eventType,
responderEvent.nativeEvent
);
}

@@ -123,3 +126,6 @@ let eventPaths = (0, import_utils2.getResponderPaths)(domEvent);

if (currentResponderIdPath != null && eventIdPath != null) {
const lowestCommonAncestor = (0, import_utils2.getLowestCommonAncestor)(currentResponderIdPath, eventIdPath);
const lowestCommonAncestor = (0, import_utils2.getLowestCommonAncestor)(
currentResponderIdPath,
eventIdPath
);
if (lowestCommonAncestor != null) {

@@ -126,0 +132,0 @@ const indexOfLowestCommonAncestor = eventIdPath.indexOf(lowestCommonAncestor);

@@ -132,3 +132,3 @@ "use strict";

if (touchBank.length > MAX_TOUCH_BANK) {
printed += " (original size: " + touchBank.length + ")";
printed += ` (original size: ${touchBank.length})`;
}

@@ -149,5 +149,9 @@ return printed;

if ((0, import_types.isMoveish)(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchMove(touch, touchHistory));
nativeEvent.changedTouches.forEach(
(touch) => recordTouchMove(touch, touchHistory)
);
} else if ((0, import_types.isStartish)(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchStart(touch, touchHistory));
nativeEvent.changedTouches.forEach(
(touch) => recordTouchStart(touch, touchHistory)
);
touchHistory.numberActiveTouches = nativeEvent.touches.length;

@@ -158,3 +162,5 @@ if (touchHistory.numberActiveTouches === 1) {

} else if ((0, import_types.isEndish)(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchEnd(touch, touchHistory));
nativeEvent.changedTouches.forEach(
(touch) => recordTouchEnd(touch, touchHistory)
);
touchHistory.numberActiveTouches = nativeEvent.touches.length;

@@ -165,3 +171,3 @@ if (touchHistory.numberActiveTouches === 1) {

const touchTrackToCheck = touchBank[i];
if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
if (touchTrackToCheck == null ? void 0 : touchTrackToCheck.touchActive) {
touchHistory.indexOfSingleActiveTouch = i;

@@ -173,3 +179,3 @@ break;

const activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
if (!(activeRecord != null && activeRecord.touchActive)) {
if (!(activeRecord == null ? void 0 : activeRecord.touchActive)) {
console.error("Cannot find single active touch.");

@@ -176,0 +182,0 @@ }

@@ -18,10 +18,8 @@ import { getBoundingClientRect } from "./utils";

const shiftKey = domEvent.shiftKey === true;
const force = domEventChangedTouches && domEventChangedTouches[0].force || 0;
const identifier = normalizeIdentifier(
domEventChangedTouches && domEventChangedTouches[0].identifier || 0
);
const clientX = domEventChangedTouches && domEventChangedTouches[0].clientX || domEvent.clientX;
const clientY = domEventChangedTouches && domEventChangedTouches[0].clientY || domEvent.clientY;
const pageX = domEventChangedTouches && domEventChangedTouches[0].pageX || domEvent.pageX;
const pageY = domEventChangedTouches && domEventChangedTouches[0].pageY || domEvent.pageY;
const force = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].force) || 0;
const identifier = normalizeIdentifier((domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].identifier) || 0);
const clientX = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].clientX) || domEvent.clientX;
const clientY = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].clientY) || domEvent.clientY;
const pageX = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].pageX) || domEvent.pageX;
const pageY = (domEventChangedTouches == null ? void 0 : domEventChangedTouches[0].pageY) || domEvent.pageY;
const preventDefault = typeof domEvent.preventDefault === "function" ? domEvent.preventDefault.bind(domEvent) : emptyFunction;

@@ -28,0 +26,0 @@ const timestamp = domEvent.timeStamp;

import createResponderEvent from "./createResponderEvent";
import { ResponderTouchHistoryStore } from "./ResponderTouchHistoryStore";
import { isCancelish, isEndish, isMoveish, isScroll, isSelectionChange, isStartish } from "./types";
import {
isCancelish,
isEndish,
isMoveish,
isScroll,
isSelectionChange,
isStartish
} from "./types";
import { canUseDOM } from "./utils";

@@ -87,3 +94,6 @@ import {

}
responderTouchHistoryStore.recordTouchTrack(eventType, responderEvent.nativeEvent);
responderTouchHistoryStore.recordTouchTrack(
eventType,
responderEvent.nativeEvent
);
}

@@ -97,3 +107,6 @@ let eventPaths = getResponderPaths(domEvent);

if (currentResponderIdPath != null && eventIdPath != null) {
const lowestCommonAncestor = getLowestCommonAncestor(currentResponderIdPath, eventIdPath);
const lowestCommonAncestor = getLowestCommonAncestor(
currentResponderIdPath,
eventIdPath
);
if (lowestCommonAncestor != null) {

@@ -100,0 +113,0 @@ const indexOfLowestCommonAncestor = eventIdPath.indexOf(lowestCommonAncestor);

@@ -109,3 +109,3 @@ import { isEndish, isMoveish, isStartish } from "./types";

if (touchBank.length > MAX_TOUCH_BANK) {
printed += " (original size: " + touchBank.length + ")";
printed += ` (original size: ${touchBank.length})`;
}

@@ -126,5 +126,9 @@ return printed;

if (isMoveish(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchMove(touch, touchHistory));
nativeEvent.changedTouches.forEach(
(touch) => recordTouchMove(touch, touchHistory)
);
} else if (isStartish(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchStart(touch, touchHistory));
nativeEvent.changedTouches.forEach(
(touch) => recordTouchStart(touch, touchHistory)
);
touchHistory.numberActiveTouches = nativeEvent.touches.length;

@@ -135,3 +139,5 @@ if (touchHistory.numberActiveTouches === 1) {

} else if (isEndish(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchEnd(touch, touchHistory));
nativeEvent.changedTouches.forEach(
(touch) => recordTouchEnd(touch, touchHistory)
);
touchHistory.numberActiveTouches = nativeEvent.touches.length;

@@ -142,3 +148,3 @@ if (touchHistory.numberActiveTouches === 1) {

const touchTrackToCheck = touchBank[i];
if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
if (touchTrackToCheck == null ? void 0 : touchTrackToCheck.touchActive) {
touchHistory.indexOfSingleActiveTouch = i;

@@ -150,3 +156,3 @@ break;

const activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
if (!(activeRecord != null && activeRecord.touchActive)) {
if (!(activeRecord == null ? void 0 : activeRecord.touchActive)) {
console.error("Cannot find single active touch.");

@@ -153,0 +159,0 @@ }

{
"name": "@tamagui/react-native-use-responder-events",
"version": "1.0.1-rc.5.1",
"version": "1.0.1-rc.6",
"types": "./types/index.d.ts",

@@ -15,4 +15,4 @@ "main": "dist/cjs",

"watch": "tamagui-build --watch",
"lint": "eslint src",
"lint:fix": "yarn lint --fix",
"lint": "../../node_modules/.bin/rome check src",
"lint:fix": "../../node_modules/.bin/rome check --apply-suggested src",
"clean": "tamagui-build clean",

@@ -25,3 +25,3 @@ "clean:build": "tamagui-build clean:build"

"devDependencies": {
"@tamagui/build": "^1.0.1-rc.5.1",
"@tamagui/build": "^1.0.1-rc.6",
"@types/react": "^18.0.15"

@@ -28,0 +28,0 @@ },

@@ -7,3 +7,6 @@ /**

import { ResponderTouchHistoryStore, TouchHistory } from './ResponderTouchHistoryStore'
import {
ResponderTouchHistoryStore,
TouchHistory,
} from './ResponderTouchHistoryStore'
import { getBoundingClientRect } from './utils'

@@ -55,3 +58,3 @@

domEvent: any,
responderTouchHistoryStore: ResponderTouchHistoryStore
responderTouchHistoryStore: ResponderTouchHistoryStore,
): ResponderEvent {

@@ -68,10 +71,8 @@ let rect

const shiftKey = domEvent.shiftKey === true
const force = (domEventChangedTouches && domEventChangedTouches[0].force) || 0
const identifier = normalizeIdentifier(
(domEventChangedTouches && domEventChangedTouches[0].identifier) || 0
)
const clientX = (domEventChangedTouches && domEventChangedTouches[0].clientX) || domEvent.clientX
const clientY = (domEventChangedTouches && domEventChangedTouches[0].clientY) || domEvent.clientY
const pageX = (domEventChangedTouches && domEventChangedTouches[0].pageX) || domEvent.pageX
const pageY = (domEventChangedTouches && domEventChangedTouches[0].pageY) || domEvent.pageY
const force = domEventChangedTouches?.[0].force || 0
const identifier = normalizeIdentifier(domEventChangedTouches?.[0].identifier || 0)
const clientX = domEventChangedTouches?.[0].clientX || domEvent.clientX
const clientY = domEventChangedTouches?.[0].clientY || domEvent.clientY
const pageX = domEventChangedTouches?.[0].pageX || domEvent.pageX
const pageY = domEventChangedTouches?.[0].pageY || domEvent.pageY
const preventDefault =

@@ -124,3 +125,5 @@ typeof domEvent.preventDefault === 'function'

touches =
domEventType === 'mouseup' || domEventType === 'dragstart' ? emptyArray : emulatedTouches
domEventType === 'mouseup' || domEventType === 'dragstart'
? emptyArray
: emulatedTouches
}

@@ -127,0 +130,0 @@

@@ -10,3 +10,10 @@ /**

import { ResponderTouchHistoryStore } from './ResponderTouchHistoryStore'
import { isCancelish, isEndish, isMoveish, isScroll, isSelectionChange, isStartish } from './types'
import {
isCancelish,
isEndish,
isMoveish,
isScroll,
isSelectionChange,
isStartish,
} from './types'
import { canUseDOM } from './utils'

@@ -61,3 +68,5 @@ import {

onSelectionChangeShouldSetResponder?: ((e: ResponderEvent) => boolean) | null
onSelectionChangeShouldSetResponderCapture?: ((e: ResponderEvent) => boolean) | null
onSelectionChangeShouldSetResponderCapture?:
| ((e: ResponderEvent) => boolean)
| null
}

@@ -181,3 +190,6 @@

}
responderTouchHistoryStore.recordTouchTrack(eventType, responderEvent.nativeEvent as any)
responderTouchHistoryStore.recordTouchTrack(
eventType,
responderEvent.nativeEvent as any,
)
}

@@ -201,3 +213,6 @@

if (currentResponderIdPath != null && eventIdPath != null) {
const lowestCommonAncestor = getLowestCommonAncestor(currentResponderIdPath, eventIdPath)
const lowestCommonAncestor = getLowestCommonAncestor(
currentResponderIdPath,
eventIdPath,
)
if (lowestCommonAncestor != null) {

@@ -207,3 +222,4 @@ const indexOfLowestCommonAncestor = eventIdPath.indexOf(lowestCommonAncestor)

const index =
indexOfLowestCommonAncestor + (lowestCommonAncestor === currentResponder.id ? 1 : 0)
indexOfLowestCommonAncestor +
(lowestCommonAncestor === currentResponder.id ? 1 : 0)
eventPaths = {

@@ -266,3 +282,5 @@ idPath: eventIdPath.slice(index),

// responder (or ancestors) blur
(eventType === 'blur' && eventTarget.contains(node) && domEvent.relatedTarget !== node) ||
(eventType === 'blur' &&
eventTarget.contains(node) &&
domEvent.relatedTarget !== node) ||
// native scroll without using a pointer

@@ -307,3 +325,4 @@ (isScrollEvent && trackedTouchCount === 0) ||

} else if (onResponderTerminationRequest != null) {
responderEvent.dispatchConfig.registrationName = 'onResponderTerminationRequest'
responderEvent.dispatchConfig.registrationName =
'onResponderTerminationRequest'
if (onResponderTerminationRequest(responderEvent) === false) {

@@ -397,3 +416,6 @@ shouldTerminate = false

*/
function attemptTransfer(responderEvent: ResponderEvent, wantsResponder: ActiveResponderInstance) {
function attemptTransfer(
responderEvent: ResponderEvent,
wantsResponder: ActiveResponderInstance,
) {
const { id: currentId, node: currentNode } = currentResponder

@@ -419,3 +441,4 @@ const { id, node } = wantsResponder

else {
const { onResponderTerminate, onResponderTerminationRequest } = getResponderConfig(currentId)
const { onResponderTerminate, onResponderTerminationRequest } =
getResponderConfig(currentId)

@@ -425,3 +448,4 @@ let allowTransfer = true

responderEvent.currentTarget = currentNode
responderEvent.dispatchConfig.registrationName = 'onResponderTerminationRequest'
responderEvent.dispatchConfig.registrationName =
'onResponderTerminationRequest'
if (onResponderTerminationRequest(responderEvent) === false) {

@@ -428,0 +452,0 @@ allowTransfer = false

@@ -89,3 +89,3 @@ /**

identifier,
MAX_TOUCH_BANK
MAX_TOUCH_BANK,
)

@@ -124,3 +124,3 @@ }

`Touch Move: ${printTouch(touch)}\n`,
`Touch Bank: ${printTouchBank(touchHistory)}`
`Touch Bank: ${printTouchBank(touchHistory)}`,
)

@@ -146,3 +146,3 @@ }

`Touch End: ${printTouch(touch)}\n`,
`Touch Bank: ${printTouchBank(touchHistory)}`
`Touch Bank: ${printTouchBank(touchHistory)}`,
)

@@ -165,3 +165,3 @@ }

if (touchBank.length > MAX_TOUCH_BANK) {
printed += ' (original size: ' + touchBank.length + ')'
printed += ` (original size: ${touchBank.length})`
}

@@ -185,5 +185,9 @@ return printed

if (isMoveish(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchMove(touch, touchHistory))
nativeEvent.changedTouches.forEach((touch) =>
recordTouchMove(touch, touchHistory),
)
} else if (isStartish(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchStart(touch, touchHistory))
nativeEvent.changedTouches.forEach((touch) =>
recordTouchStart(touch, touchHistory),
)
touchHistory.numberActiveTouches = nativeEvent.touches.length

@@ -194,3 +198,5 @@ if (touchHistory.numberActiveTouches === 1) {

} else if (isEndish(topLevelType)) {
nativeEvent.changedTouches.forEach((touch) => recordTouchEnd(touch, touchHistory))
nativeEvent.changedTouches.forEach((touch) =>
recordTouchEnd(touch, touchHistory),
)
touchHistory.numberActiveTouches = nativeEvent.touches.length

@@ -202,3 +208,3 @@ if (touchHistory.numberActiveTouches === 1) {

// @ts-ignore
if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
if (touchTrackToCheck?.touchActive) {
touchHistory.indexOfSingleActiveTouch = i

@@ -211,3 +217,3 @@ break

// @ts-ignore
if (!(activeRecord != null && activeRecord.touchActive)) {
if (!activeRecord?.touchActive) {
// eslint-disable-next-line no-console

@@ -214,0 +220,0 @@ console.error('Cannot find single active touch.')

@@ -17,3 +17,3 @@ /**

hostRef: any,
config: ResponderSystem.ResponderConfig = emptyObject
config: ResponderSystem.ResponderConfig = emptyObject,
) {

@@ -20,0 +20,0 @@ const id = React.useId()

@@ -176,3 +176,7 @@ /**

if (isTouch || (isPrimaryMouseDown && noModifiers) || (isPrimaryMouseMove && noModifiers)) {
if (
isTouch ||
(isPrimaryMouseDown && noModifiers) ||
(isPrimaryMouseMove && noModifiers)
) {
return true

@@ -179,0 +183,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc