📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

react-native-gesture-handler

Package Overview
Dependencies
Maintainers
5
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-gesture-handler - npm Package Compare versions

Comparing version

to
2.25.0

android/nosvg/src/main/java/com/swmansion/gesturehandler/RNSVGHitTester.kt

9

lib/commonjs/components/GestureButtons.js

@@ -146,2 +146,4 @@ "use strict";

const AnimatedInnerBaseButton = _reactNative.Animated.createAnimatedComponent(InnerBaseButton);
const BaseButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(InnerBaseButton, _extends({

@@ -151,5 +153,6 @@ innerRef: ref

exports.BaseButton = BaseButton;
const AnimatedBaseButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(AnimatedInnerBaseButton, _extends({
innerRef: ref
}, props)));
const AnimatedBaseButton = _reactNative.Animated.createAnimatedComponent(BaseButton);
const btnStyles = _reactNative.StyleSheet.create({

@@ -249,4 +252,2 @@ underlay: {

return /*#__PURE__*/React.createElement(AnimatedBaseButton, _extends({}, rest, {
// @ts-ignore We don't want `innerRef` to be accessible from public API.
// However in this case we need to set it indirectly on `BaseButton`, hence we use ts-ignore
innerRef: innerRef,

@@ -253,0 +254,0 @@ onActiveStateChange: this.onActiveStateChange,

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

});
exports.default = Pressable;
exports.default = void 0;

@@ -36,4 +36,3 @@ var _react = _interopRequireWildcard(require("react"));

let IS_FABRIC = null;
function Pressable(props) {
const Pressable = /*#__PURE__*/(0, _react.forwardRef)((props, pressableRef) => {
var _android_ripple$radiu;

@@ -60,6 +59,6 @@

disabled,
accessible,
...remainingProps
} = props;
const [pressedState, setPressedState] = (0, _react.useState)(testOnly_pressed !== null && testOnly_pressed !== void 0 ? testOnly_pressed : false);
const pressableRef = (0, _react.useRef)(null); // Disabled when onLongPress has been called
const [pressedState, setPressedState] = (0, _react.useState)(testOnly_pressed !== null && testOnly_pressed !== void 0 ? testOnly_pressed : false); // Disabled when onLongPress has been called

@@ -117,2 +116,20 @@ const isPressCallbackEnabled = (0, _react.useRef)(true);

const pressOutHandler = (0, _react.useCallback)(event => {
if (!isTouchPropagationAllowed.current) {
hasPassedBoundsChecks.current = false;
isPressCallbackEnabled.current = true;
deferredEventPayload.current = null;
if (longPressTimeoutRef.current) {
clearTimeout(longPressTimeoutRef.current);
longPressTimeoutRef.current = null;
}
if (pressDelayTimeoutRef.current) {
clearTimeout(pressDelayTimeoutRef.current);
pressDelayTimeoutRef.current = null;
}
return;
}
if (!hasPassedBoundsChecks.current || event.nativeEvent.touches.length > event.nativeEvent.changedTouches.length) {

@@ -171,40 +188,53 @@ return;

const longPressMinDuration = (delayLongPress !== null && delayLongPress !== void 0 ? delayLongPress : DEFAULT_LONG_PRESS_DURATION) + (unstable_pressDelay !== null && unstable_pressDelay !== void 0 ? unstable_pressDelay : 0);
const innerPressableRef = (0, _react.useRef)(null);
const measureCallback = (0, _react.useCallback)((width, height, event) => {
var _onEndHandlingTouches;
if (!(0, _utils.isTouchWithinInset)({
width,
height
}, normalizedHitSlop, event.changedTouches.at(-1)) || hasPassedBoundsChecks.current || cancelledMidPress.current) {
cancelledMidPress.current = false;
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
return;
}
hasPassedBoundsChecks.current = true; // In case of multiple touches, the first one starts long press gesture
if (longPressTimeoutRef.current === null) {
// Start long press gesture timer
longPressTimeoutRef.current = setTimeout(() => activateLongPress(event), longPressMinDuration);
}
if (unstable_pressDelay) {
pressDelayTimeoutRef.current = setTimeout(() => {
pressInHandler((0, _utils.gestureTouchToPressableEvent)(event));
}, unstable_pressDelay);
} else {
pressInHandler((0, _utils.gestureTouchToPressableEvent)(event));
}
(_onEndHandlingTouches = onEndHandlingTouchesDown.current) === null || _onEndHandlingTouches === void 0 ? void 0 : _onEndHandlingTouches.call(onEndHandlingTouchesDown);
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
}, [activateLongPress, longPressMinDuration, normalizedHitSlop, pressInHandler, unstable_pressDelay]);
const pressAndTouchGesture = (0, _react.useMemo)(() => _gestureObjects.GestureObjects.LongPress().minDuration(_utils2.INT32_MAX) // Stops long press from blocking native gesture
.maxDistance(_utils2.INT32_MAX) // Stops long press from cancelling after set distance
.cancelsTouchesInView(false).onTouchesDown(event => {
var _pressableRef$current;
handlingOnTouchesDown.current = true;
(_pressableRef$current = pressableRef.current) === null || _pressableRef$current === void 0 ? void 0 : _pressableRef$current.measure((_x, _y, width, height) => {
var _onEndHandlingTouches;
if (!(0, _utils.isTouchWithinInset)({
width,
height
}, normalizedHitSlop, event.changedTouches.at(-1)) || hasPassedBoundsChecks.current || cancelledMidPress.current) {
cancelledMidPress.current = false;
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
return;
}
if (pressableRef) {
var _current;
hasPassedBoundsChecks.current = true; // In case of multiple touches, the first one starts long press gesture
(_current = pressableRef.current) === null || _current === void 0 ? void 0 : _current.measure((_x, _y, width, height) => {
measureCallback(width, height, event);
});
} else {
var _innerPressableRef$cu;
if (longPressTimeoutRef.current === null) {
// Start long press gesture timer
longPressTimeoutRef.current = setTimeout(() => activateLongPress(event), longPressMinDuration);
}
if (unstable_pressDelay) {
pressDelayTimeoutRef.current = setTimeout(() => {
pressInHandler((0, _utils.gestureTouchToPressableEvent)(event));
}, unstable_pressDelay);
} else {
pressInHandler((0, _utils.gestureTouchToPressableEvent)(event));
}
(_onEndHandlingTouches = onEndHandlingTouchesDown.current) === null || _onEndHandlingTouches === void 0 ? void 0 : _onEndHandlingTouches.call(onEndHandlingTouchesDown);
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
});
(_innerPressableRef$cu = innerPressableRef.current) === null || _innerPressableRef$cu === void 0 ? void 0 : _innerPressableRef$cu.measure((_x, _y, width, height) => {
measureCallback(width, height, event);
});
}
}).onTouchesUp(event => {

@@ -240,3 +270,3 @@ if (handlingOnTouchesDown.current) {

pressOutHandler((0, _utils.gestureTouchToPressableEvent)(event));
}), [activateLongPress, longPressMinDuration, normalizedHitSlop, pressInHandler, pressOutHandler, unstable_pressDelay]); // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events
}), [pressableRef, measureCallback, pressOutHandler]); // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events

@@ -279,3 +309,6 @@ const buttonGesture = (0, _react.useMemo)(() => _gestureObjects.GestureObjects.Native().onBegin(() => {

shouldPreventNativeEffects.current = false;
return;
if (!handlingOnTouchesDown.current) {
return;
}
}

@@ -325,3 +358,4 @@

}, /*#__PURE__*/_react.default.createElement(_GestureHandlerButton.default, _extends({}, remainingProps, {
ref: pressableRef,
ref: pressableRef !== null && pressableRef !== void 0 ? pressableRef : innerPressableRef,
accessible: accessible !== false,
hitSlop: appliedHitSlop,

@@ -341,3 +375,5 @@ enabled: isPressableEnabled,

}) : null));
}
});
var _default = Pressable;
exports.default = _default;
//# sourceMappingURL=Pressable.js.map

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

var _UIManagerAny$getView, _UIManagerAny$getView2, _UIManagerAny$getCons;
var _UIManagerAny$getView;

@@ -84,8 +84,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

...customGHEventsConfig
}; // In newer versions of RN the `genericDirectEventTypes` is located in the object
// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make
// it compatible with RN 61+
};
const UIManagerConstants = (_UIManagerAny$getView = UIManagerAny.getViewManagerConfig) === null || _UIManagerAny$getView === void 0 ? void 0 : _UIManagerAny$getView.call(UIManagerAny, 'getConstants');
const UIManagerConstants = (_UIManagerAny$getView = (_UIManagerAny$getView2 = UIManagerAny.getViewManagerConfig) === null || _UIManagerAny$getView2 === void 0 ? void 0 : _UIManagerAny$getView2.call(UIManagerAny, 'getConstants')) !== null && _UIManagerAny$getView !== void 0 ? _UIManagerAny$getView : (_UIManagerAny$getCons = UIManagerAny.getConstants) === null || _UIManagerAny$getCons === void 0 ? void 0 : _UIManagerAny$getCons.call(UIManagerAny);
if (UIManagerConstants) {

@@ -161,3 +158,3 @@ UIManagerConstants.genericDirectEventTypes = { ...UIManagerConstants.genericDirectEventTypes,

_defineProperty(this, "handlerTag", void 0);
_defineProperty(this, "handlerTag", -1);

@@ -233,2 +230,3 @@ _defineProperty(this, "config", void 0);

_defineProperty(this, "createGestureHandler", newConfig => {
this.handlerTag = (0, _getNextHandlerTag.getNextHandlerTag)();
this.config = newConfig;

@@ -290,3 +288,2 @@

this.handlerTag = (0, _getNextHandlerTag.getNextHandlerTag)();
this.config = {};

@@ -293,0 +290,0 @@ this.propsRef = /*#__PURE__*/React.createRef();

@@ -32,17 +32,24 @@ "use strict";

}
} // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
} // Store attached gestures to avoid crash when gestures changed after queueing micro task
const attachedGestures = preparedGesture.attachedGestures; // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
// and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
// in case of external relations)
(0, _ghQueueMicrotask.ghQueueMicrotask)(() => {
if (!preparedGesture.isMounted) {
return;
} // Stop if attached gestures changed after queueing micro task
if (attachedGestures !== preparedGesture.attachedGestures) {
return;
} // If amount of gesture configs changes, we need to update the callbacks in shared value
let shouldUpdateSharedValueIfUsed = preparedGesture.attachedGestures.length !== newGestures.length;
let shouldUpdateSharedValueIfUsed = attachedGestures.length !== newGestures.length;
for (let i = 0; i < newGestures.length; i++) {
const handler = preparedGesture.attachedGestures[i]; // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
const handler = attachedGestures[i]; // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
// we need to update the shared value, assuming the gesture runs on UI thread or the thread changed

@@ -63,3 +70,3 @@

if (preparedGesture.animatedHandlers && shouldUpdateSharedValueIfUsed) {
const newHandlersValue = preparedGesture.attachedGestures.filter(g => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI
const newHandlersValue = attachedGestures.filter(g => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI
.map(g => g.handlers);

@@ -66,0 +73,0 @@ preparedGesture.animatedHandlers.value = newHandlersValue;

@@ -37,4 +37,2 @@ "use strict";

var _getReactNativeVersion = require("../../../getReactNativeVersion");
var _RNRenderer = require("../../../RNRenderer");

@@ -138,8 +136,6 @@

if (__DEV__ && _reactNative.Platform.OS !== 'web') {
const REACT_NATIVE_VERSION = (0, _getReactNativeVersion.getReactNativeVersion)(); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const wrapType = // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternals.elementType; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const wrapType = REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0 ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternals.elementType : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternalFiber.elementType; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
let instance = _RNRenderer.RNRenderer.findHostInstance_DEPRECATED(ref)._internalFiberInstanceHandleDEV; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

@@ -146,0 +142,0 @@

@@ -270,3 +270,2 @@ "use strict";

if (handler.awaiting || handler.state === _State.State.ACTIVE) {
// For now it always returns false
return handler.shouldBeCancelledByOther(otherHandler);

@@ -273,0 +272,0 @@ }

@@ -8,4 +8,2 @@ "use strict";

var _State = require("../../State");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -92,3 +90,3 @@

const isNativeHandler = otherHandler.constructor.name === 'NativeViewGestureHandler';
const isActive = otherHandler.state === _State.State.ACTIVE;
const isActive = otherHandler.active;
const isButton = ((_otherHandler$isButto = otherHandler.isButton) === null || _otherHandler$isButto === void 0 ? void 0 : _otherHandler$isButto.call(otherHandler)) === true;

@@ -95,0 +93,0 @@ return isNativeHandler && isActive && !isButton;

@@ -120,6 +120,9 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

const AnimatedInnerBaseButton = Animated.createAnimatedComponent(InnerBaseButton);
export const BaseButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(InnerBaseButton, _extends({
innerRef: ref
}, props)));
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
const AnimatedBaseButton = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(AnimatedInnerBaseButton, _extends({
innerRef: ref
}, props)));
const btnStyles = StyleSheet.create({

@@ -216,4 +219,2 @@ underlay: {

return /*#__PURE__*/React.createElement(AnimatedBaseButton, _extends({}, rest, {
// @ts-ignore We don't want `innerRef` to be accessible from public API.
// However in this case we need to set it indirectly on `BaseButton`, hence we use ts-ignore
innerRef: innerRef,

@@ -220,0 +221,0 @@ onActiveStateChange: this.onActiveStateChange,

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React, { useCallback, useMemo, useRef, useState } from 'react';
import React, { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
import { GestureObjects as Gesture } from '../../handlers/gestures/gestureObjects';

@@ -14,3 +14,3 @@ import { GestureDetector } from '../../handlers/gestures/GestureDetector';

let IS_FABRIC = null;
export default function Pressable(props) {
const Pressable = /*#__PURE__*/forwardRef((props, pressableRef) => {
var _android_ripple$radiu;

@@ -37,6 +37,6 @@

disabled,
accessible,
...remainingProps
} = props;
const [pressedState, setPressedState] = useState(testOnly_pressed !== null && testOnly_pressed !== void 0 ? testOnly_pressed : false);
const pressableRef = useRef(null); // Disabled when onLongPress has been called
const [pressedState, setPressedState] = useState(testOnly_pressed !== null && testOnly_pressed !== void 0 ? testOnly_pressed : false); // Disabled when onLongPress has been called

@@ -94,2 +94,20 @@ const isPressCallbackEnabled = useRef(true);

const pressOutHandler = useCallback(event => {
if (!isTouchPropagationAllowed.current) {
hasPassedBoundsChecks.current = false;
isPressCallbackEnabled.current = true;
deferredEventPayload.current = null;
if (longPressTimeoutRef.current) {
clearTimeout(longPressTimeoutRef.current);
longPressTimeoutRef.current = null;
}
if (pressDelayTimeoutRef.current) {
clearTimeout(pressDelayTimeoutRef.current);
pressDelayTimeoutRef.current = null;
}
return;
}
if (!hasPassedBoundsChecks.current || event.nativeEvent.touches.length > event.nativeEvent.changedTouches.length) {

@@ -148,40 +166,53 @@ return;

const longPressMinDuration = (delayLongPress !== null && delayLongPress !== void 0 ? delayLongPress : DEFAULT_LONG_PRESS_DURATION) + (unstable_pressDelay !== null && unstable_pressDelay !== void 0 ? unstable_pressDelay : 0);
const innerPressableRef = useRef(null);
const measureCallback = useCallback((width, height, event) => {
var _onEndHandlingTouches;
if (!isTouchWithinInset({
width,
height
}, normalizedHitSlop, event.changedTouches.at(-1)) || hasPassedBoundsChecks.current || cancelledMidPress.current) {
cancelledMidPress.current = false;
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
return;
}
hasPassedBoundsChecks.current = true; // In case of multiple touches, the first one starts long press gesture
if (longPressTimeoutRef.current === null) {
// Start long press gesture timer
longPressTimeoutRef.current = setTimeout(() => activateLongPress(event), longPressMinDuration);
}
if (unstable_pressDelay) {
pressDelayTimeoutRef.current = setTimeout(() => {
pressInHandler(gestureTouchToPressableEvent(event));
}, unstable_pressDelay);
} else {
pressInHandler(gestureTouchToPressableEvent(event));
}
(_onEndHandlingTouches = onEndHandlingTouchesDown.current) === null || _onEndHandlingTouches === void 0 ? void 0 : _onEndHandlingTouches.call(onEndHandlingTouchesDown);
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
}, [activateLongPress, longPressMinDuration, normalizedHitSlop, pressInHandler, unstable_pressDelay]);
const pressAndTouchGesture = useMemo(() => Gesture.LongPress().minDuration(INT32_MAX) // Stops long press from blocking native gesture
.maxDistance(INT32_MAX) // Stops long press from cancelling after set distance
.cancelsTouchesInView(false).onTouchesDown(event => {
var _pressableRef$current;
handlingOnTouchesDown.current = true;
(_pressableRef$current = pressableRef.current) === null || _pressableRef$current === void 0 ? void 0 : _pressableRef$current.measure((_x, _y, width, height) => {
var _onEndHandlingTouches;
if (!isTouchWithinInset({
width,
height
}, normalizedHitSlop, event.changedTouches.at(-1)) || hasPassedBoundsChecks.current || cancelledMidPress.current) {
cancelledMidPress.current = false;
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
return;
}
if (pressableRef) {
var _current;
hasPassedBoundsChecks.current = true; // In case of multiple touches, the first one starts long press gesture
(_current = pressableRef.current) === null || _current === void 0 ? void 0 : _current.measure((_x, _y, width, height) => {
measureCallback(width, height, event);
});
} else {
var _innerPressableRef$cu;
if (longPressTimeoutRef.current === null) {
// Start long press gesture timer
longPressTimeoutRef.current = setTimeout(() => activateLongPress(event), longPressMinDuration);
}
if (unstable_pressDelay) {
pressDelayTimeoutRef.current = setTimeout(() => {
pressInHandler(gestureTouchToPressableEvent(event));
}, unstable_pressDelay);
} else {
pressInHandler(gestureTouchToPressableEvent(event));
}
(_onEndHandlingTouches = onEndHandlingTouchesDown.current) === null || _onEndHandlingTouches === void 0 ? void 0 : _onEndHandlingTouches.call(onEndHandlingTouchesDown);
onEndHandlingTouchesDown.current = null;
handlingOnTouchesDown.current = false;
});
(_innerPressableRef$cu = innerPressableRef.current) === null || _innerPressableRef$cu === void 0 ? void 0 : _innerPressableRef$cu.measure((_x, _y, width, height) => {
measureCallback(width, height, event);
});
}
}).onTouchesUp(event => {

@@ -217,3 +248,3 @@ if (handlingOnTouchesDown.current) {

pressOutHandler(gestureTouchToPressableEvent(event));
}), [activateLongPress, longPressMinDuration, normalizedHitSlop, pressInHandler, pressOutHandler, unstable_pressDelay]); // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events
}), [pressableRef, measureCallback, pressOutHandler]); // RNButton is placed inside ButtonGesture to enable Android's ripple and to capture non-propagating events

@@ -256,3 +287,6 @@ const buttonGesture = useMemo(() => Gesture.Native().onBegin(() => {

shouldPreventNativeEffects.current = false;
return;
if (!handlingOnTouchesDown.current) {
return;
}
}

@@ -300,3 +334,4 @@

}, /*#__PURE__*/React.createElement(NativeButton, _extends({}, remainingProps, {
ref: pressableRef,
ref: pressableRef !== null && pressableRef !== void 0 ? pressableRef : innerPressableRef,
accessible: accessible !== false,
hitSlop: appliedHitSlop,

@@ -316,3 +351,4 @@ enabled: isPressableEnabled,

}) : null));
}
});
export default Pressable;
//# sourceMappingURL=Pressable.js.map

@@ -1,2 +0,2 @@

var _UIManagerAny$getView, _UIManagerAny$getView2, _UIManagerAny$getCons;
var _UIManagerAny$getView;

@@ -55,8 +55,5 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

...customGHEventsConfig
}; // In newer versions of RN the `genericDirectEventTypes` is located in the object
// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make
// it compatible with RN 61+
};
const UIManagerConstants = (_UIManagerAny$getView = UIManagerAny.getViewManagerConfig) === null || _UIManagerAny$getView === void 0 ? void 0 : _UIManagerAny$getView.call(UIManagerAny, 'getConstants');
const UIManagerConstants = (_UIManagerAny$getView = (_UIManagerAny$getView2 = UIManagerAny.getViewManagerConfig) === null || _UIManagerAny$getView2 === void 0 ? void 0 : _UIManagerAny$getView2.call(UIManagerAny, 'getConstants')) !== null && _UIManagerAny$getView !== void 0 ? _UIManagerAny$getView : (_UIManagerAny$getCons = UIManagerAny.getConstants) === null || _UIManagerAny$getCons === void 0 ? void 0 : _UIManagerAny$getCons.call(UIManagerAny);
if (UIManagerConstants) {

@@ -130,3 +127,3 @@ UIManagerConstants.genericDirectEventTypes = { ...UIManagerConstants.genericDirectEventTypes,

_defineProperty(this, "handlerTag", void 0);
_defineProperty(this, "handlerTag", -1);

@@ -202,2 +199,3 @@ _defineProperty(this, "config", void 0);

_defineProperty(this, "createGestureHandler", newConfig => {
this.handlerTag = getNextHandlerTag();
this.config = newConfig;

@@ -256,3 +254,2 @@ RNGestureHandlerModule.createGestureHandler(name, this.handlerTag, newConfig);

this.handlerTag = getNextHandlerTag();
this.config = {};

@@ -259,0 +256,0 @@ this.propsRef = /*#__PURE__*/React.createRef();

@@ -18,17 +18,24 @@ import { registerHandler } from '../../handlersRegistry';

}
} // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
} // Store attached gestures to avoid crash when gestures changed after queueing micro task
const attachedGestures = preparedGesture.attachedGestures; // Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated
// and handlerTags in BaseGesture references should be updated in the loop above (we need to wait
// in case of external relations)
ghQueueMicrotask(() => {
if (!preparedGesture.isMounted) {
return;
} // Stop if attached gestures changed after queueing micro task
if (attachedGestures !== preparedGesture.attachedGestures) {
return;
} // If amount of gesture configs changes, we need to update the callbacks in shared value
let shouldUpdateSharedValueIfUsed = preparedGesture.attachedGestures.length !== newGestures.length;
let shouldUpdateSharedValueIfUsed = attachedGestures.length !== newGestures.length;
for (let i = 0; i < newGestures.length; i++) {
const handler = preparedGesture.attachedGestures[i]; // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
const handler = attachedGestures[i]; // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),
// we need to update the shared value, assuming the gesture runs on UI thread or the thread changed

@@ -47,3 +54,3 @@

if (preparedGesture.animatedHandlers && shouldUpdateSharedValueIfUsed) {
const newHandlersValue = preparedGesture.attachedGestures.filter(g => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI
const newHandlersValue = attachedGestures.filter(g => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI
.map(g => g.handlers);

@@ -50,0 +57,0 @@ preparedGesture.animatedHandlers.value = newHandlersValue;

@@ -13,3 +13,2 @@ import { Platform } from 'react-native';

import { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';
import { getReactNativeVersion } from '../../../getReactNativeVersion';
import { RNRenderer } from '../../../RNRenderer';

@@ -106,8 +105,6 @@ import { useCallback, useRef, useState } from 'react';

if (__DEV__ && Platform.OS !== 'web') {
const REACT_NATIVE_VERSION = getReactNativeVersion(); // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const wrapType = // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternals.elementType; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const wrapType = REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0 ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternals.elementType : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternalFiber.elementType; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
let instance = RNRenderer.findHostInstance_DEPRECATED(ref)._internalFiberInstanceHandleDEV; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

@@ -114,0 +111,0 @@

@@ -258,3 +258,2 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

if (handler.awaiting || handler.state === State.ACTIVE) {
// For now it always returns false
return handler.shouldBeCancelledByOther(otherHandler);

@@ -261,0 +260,0 @@ }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { State } from '../../State';
export default class InteractionManager {

@@ -83,3 +82,3 @@ // Private becaues of singleton

const isNativeHandler = otherHandler.constructor.name === 'NativeViewGestureHandler';
const isActive = otherHandler.state === State.ACTIVE;
const isActive = otherHandler.active;
const isButton = ((_otherHandler$isButto = otherHandler.isButton) === null || _otherHandler$isButto === void 0 ? void 0 : _otherHandler$isButto.call(otherHandler)) === true;

@@ -86,0 +85,0 @@ return isNativeHandler && isActive && !isButton;

import * as React from 'react';
import type { BaseButtonProps, RectButtonProps, BorderlessButtonProps } from './GestureButtonsProps';
export declare const RawButton: React.ForwardRefExoticComponent<import("./GestureButtonsProps").RawButtonProps & import("..").NativeViewGestureHandlerProps & React.RefAttributes<React.ComponentType<any>>>;
export declare const BaseButton: React.ForwardRefExoticComponent<Omit<BaseButtonProps, "innerRef"> & React.RefAttributes<any>>;
export declare const RectButton: React.ForwardRefExoticComponent<Omit<RectButtonProps, "innerRef"> & React.RefAttributes<any>>;
export declare const BorderlessButton: React.ForwardRefExoticComponent<Omit<BorderlessButtonProps, "innerRef"> & React.RefAttributes<any>>;
export declare const BaseButton: React.ForwardRefExoticComponent<Omit<BaseButtonProps, "innerRef"> & React.RefAttributes<React.ComponentType<{}>>>;
export declare const RectButton: React.ForwardRefExoticComponent<Omit<RectButtonProps, "innerRef"> & React.RefAttributes<React.ComponentType<{}>>>;
export declare const BorderlessButton: React.ForwardRefExoticComponent<Omit<BorderlessButtonProps, "innerRef"> & React.RefAttributes<React.ComponentType<{}>>>;
export { default as PureNativeButton } from './GestureHandlerButton';
import React from 'react';
import { PressableProps } from './PressableProps';
export default function Pressable(props: PressableProps): React.JSX.Element;
import { View } from 'react-native';
declare const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<View>>;
export default Pressable;
{
"name": "react-native-gesture-handler",
"version": "2.24.0",
"version": "2.25.0",
"description": "Declarative API exposing native platform touch and gesture system to React Native",

@@ -45,2 +45,4 @@ "scripts": {

"android/packageDeprecated/",
"android/svg",
"android/nosvg",
"apple/",

@@ -158,3 +160,3 @@ "Swipeable/",

},
"packageManager": "yarn@1.22.22"
"packageManager": "yarn@4.7.0"
}

@@ -38,4 +38,7 @@ <img src="https://user-images.githubusercontent.com/16062886/117444014-2d1ffd80-af39-11eb-9bbb-33c320599d93.png" width="100%" alt="React Native Gesture Handler by Software Mansion">

`react-native-gesture-handler` supports the three latest minor releases of `react-native`.
| version | react-native version |
| ------- | -------------------- |
| 2.24.0+ | 0.75.0+ |
| 2.21.0+ | 0.74.0+ |

@@ -42,0 +45,0 @@ | 2.18.0+ | 0.73.0+ |

@@ -33,2 +33,5 @@ import { GestureType, HandlerCallbacks } from '../gesture';

// Store attached gestures to avoid crash when gestures changed after queueing micro task
const attachedGestures = preparedGesture.attachedGestures;
// Use queueMicrotask to extract handlerTags, because when it's ran, all refs should be updated

@@ -42,8 +45,13 @@ // and handlerTags in BaseGesture references should be updated in the loop above (we need to wait

// Stop if attached gestures changed after queueing micro task
if (attachedGestures !== preparedGesture.attachedGestures) {
return;
}
// If amount of gesture configs changes, we need to update the callbacks in shared value
let shouldUpdateSharedValueIfUsed =
preparedGesture.attachedGestures.length !== newGestures.length;
attachedGestures.length !== newGestures.length;
for (let i = 0; i < newGestures.length; i++) {
const handler = preparedGesture.attachedGestures[i];
const handler = attachedGestures[i];

@@ -75,3 +83,3 @@ // If the gestureId is different (gesture isn't wrapped with useMemo or its dependencies changed),

if (preparedGesture.animatedHandlers && shouldUpdateSharedValueIfUsed) {
const newHandlersValue = preparedGesture.attachedGestures
const newHandlersValue = attachedGestures
.filter((g) => g.shouldUseReanimated) // Ignore gestures that shouldn't run on UI

@@ -78,0 +86,0 @@ .map((g) => g.handlers) as unknown as HandlerCallbacks<

@@ -21,3 +21,2 @@ import { Platform } from 'react-native';

import { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';
import { getReactNativeVersion } from '../../../getReactNativeVersion';
import { RNRenderer } from '../../../RNRenderer';

@@ -137,10 +136,7 @@ import { useCallback, useRef, useState } from 'react';

if (__DEV__ && Platform.OS !== 'web') {
const REACT_NATIVE_VERSION = getReactNativeVersion();
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const wrapType =
REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0
? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternals.elementType
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternalFiber.elementType;
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
ref._reactInternals.elementType;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

@@ -147,0 +143,0 @@ let instance =

@@ -310,3 +310,2 @@ import { PointerType } from '../../PointerType';

if (handler.awaiting || handler.state === State.ACTIVE) {
// For now it always returns false
return handler.shouldBeCancelledByOther(otherHandler);

@@ -313,0 +312,0 @@ }

import type IGestureHandler from '../handlers/IGestureHandler';
import { State } from '../../State';
import { Config, Handler } from '../interfaces';

@@ -111,3 +110,3 @@

otherHandler.constructor.name === 'NativeViewGestureHandler';
const isActive = otherHandler.state === State.ACTIVE;
const isActive = otherHandler.active;
const isButton = otherHandler.isButton?.() === true;

@@ -114,0 +113,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

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

Sorry, the diff of this file is not supported yet