react-swipeable
Advanced tools
Comparing version 6.0.1 to 6.1.0
@@ -0,1 +1,12 @@ | ||
# v6.1.0 | ||
* Add new event handler prop `onSwipeStart` | ||
* called only once per swipe at the start and before the first `onSwiping` callback | ||
* The `first` property of the `SwipeEventData` will be `true` | ||
* [PR #226](https://github.com/formidablelabs/react-swipeable/pull/226) | ||
* Thank you [@feketegy](https://github.com/feketegy) for the idea! | ||
* **typescript** updated to `v4.1.3` and associated deps bumped to be compatible | ||
* [PR #228](https://github.com/formidablelabs/react-swipeable/pull/228) | ||
* Thank you [@cwise89](https://github.com/cwise89)! | ||
# v6.0.1 | ||
@@ -2,0 +13,0 @@ * Fix issue with `first` property on `SwipeEventData` always being `true`. |
@@ -129,3 +129,6 @@ var React = require('react'); | ||
vxvy: vxvy | ||
}; | ||
}; // call onSwipeStart if present and is first swipe event | ||
eventData.first && props.onSwipeStart && props.onSwipeStart(eventData); // Call onSwiping if present | ||
props.onSwiping && props.onSwiping(eventData); // track if a swipe is cancelable(handler for swiping or swiped(dir) exists) | ||
@@ -132,0 +135,0 @@ // so we can call preventDefault if needed |
@@ -110,3 +110,6 @@ import { useRef, useMemo } from 'react'; | ||
vxvy | ||
}; | ||
}; // call onSwipeStart if present and is first swipe event | ||
eventData.first && props.onSwipeStart && props.onSwipeStart(eventData); // Call onSwiping if present | ||
props.onSwiping && props.onSwiping(eventData); // track if a swipe is cancelable(handler for swiping or swiped(dir) exists) | ||
@@ -113,0 +116,0 @@ // so we can call preventDefault if needed |
@@ -129,3 +129,6 @@ import { useRef, useMemo } from 'react'; | ||
vxvy: vxvy | ||
}; | ||
}; // call onSwipeStart if present and is first swipe event | ||
eventData.first && props.onSwipeStart && props.onSwipeStart(eventData); // Call onSwiping if present | ||
props.onSwiping && props.onSwiping(eventData); // track if a swipe is cancelable(handler for swiping or swiped(dir) exists) | ||
@@ -132,0 +135,0 @@ // so we can call preventDefault if needed |
@@ -132,3 +132,6 @@ (function (global, factory) { | ||
vxvy: vxvy | ||
}; | ||
}; // call onSwipeStart if present and is first swipe event | ||
eventData.first && props.onSwipeStart && props.onSwipeStart(eventData); // Call onSwiping if present | ||
props.onSwiping && props.onSwiping(eventData); // track if a swipe is cancelable(handler for swiping or swiped(dir) exists) | ||
@@ -135,0 +138,0 @@ // so we can call preventDefault if needed |
@@ -26,2 +26,3 @@ import * as React from "react"; | ||
export declare type SwipeableCallbacks = { | ||
onSwipeStart: SwipeCallback; | ||
onSwiped: SwipeCallback; | ||
@@ -28,0 +29,0 @@ onSwipedDown: SwipeCallback; |
{ | ||
"name": "react-swipeable", | ||
"version": "6.0.1", | ||
"version": "6.1.0", | ||
"description": "React Swipe event handler hook", | ||
@@ -75,9 +75,9 @@ "main": "./dist/react-swipeable.js", | ||
"@testing-library/react": "^10.4.3", | ||
"@types/jest": "^26.0.4", | ||
"@types/jest": "^26.0.20", | ||
"@types/react": "^16.8.12", | ||
"@types/react-dom": "^16.9.8", | ||
"@typescript-eslint/eslint-plugin": "^3.6.1", | ||
"@typescript-eslint/parser": "^3.6.1", | ||
"@typescript-eslint/eslint-plugin": "^4.14.0", | ||
"@typescript-eslint/parser": "^4.14.0", | ||
"coveralls": "^3.0.3", | ||
"eslint": "^7.4.0", | ||
"eslint": "^7.18.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
@@ -97,5 +97,5 @@ "eslint-plugin-react": "^7.20.3", | ||
"size-limit": "^4.6.0", | ||
"ts-jest": "^26.1.2", | ||
"ts-jest": "^26.4.4", | ||
"ts-loader": "^8.0.1", | ||
"typescript": "^3.9.6", | ||
"typescript": "^4.1.3", | ||
"webpack": "^4.29.0", | ||
@@ -102,0 +102,0 @@ "webpack-cli": "^3.2.1", |
@@ -36,2 +36,3 @@ # React Swipeable | ||
onSwipedDown, // After DOWN swipe (SwipeEventData) => void | ||
onSwipeStart, // Start of swipe (SwipeEventData) => void *see details* | ||
onSwiping, // During swiping (SwipeEventData) => void | ||
@@ -42,2 +43,6 @@ onTap, // After a tap ({ event }) => void | ||
#### Details | ||
- `onSwipeStart` - called only once per swipe at the start and before the first `onSwiping` callback | ||
- The `first` property of the `SwipeEventData` will be `true` | ||
### Configuration props and default values | ||
@@ -44,0 +49,0 @@ |
@@ -152,2 +152,6 @@ /* global document */ | ||
// call onSwipeStart if present and is first swipe event | ||
eventData.first && props.onSwipeStart && props.onSwipeStart(eventData); | ||
// Call onSwiping if present | ||
props.onSwiping && props.onSwiping(eventData); | ||
@@ -154,0 +158,0 @@ |
@@ -32,2 +32,3 @@ import * as React from "react"; | ||
// Event handler/callbacks | ||
onSwipeStart: SwipeCallback; | ||
onSwiped: SwipeCallback; | ||
@@ -34,0 +35,0 @@ onSwipedDown: SwipeCallback; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153917
1417
198