| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2023-06-01 | 17.5 kB | |
| v7.0.1 source code.tar.gz | 2023-06-01 | 689.2 kB | |
| v7.0.1 source code.zip | 2023-06-01 | 704.4 kB | |
| Totals: 3 Items | 1.4 MB | 0 | |
Patch Changes
- Adding GitHub release workflow (#328) New Features:
- add new
swipeDurationprop - "allowable duration of a swipe"- A swipe lasting more than
swipeDuration, in milliseconds, will not be considered a swipe.- Feature mimicked from
use-gestureswipe.duration
- Feature mimicked from
- Defaults to
Infinityfor backwards compatibility
- A swipe lasting more than
- add new
touchEventOptionsprop that can set the options for the touch event listeners- this provides users full control of if/when they want to set passive
- Defaults to
{ passive: true }
- add new
onTouchStartOrOnMouseDownprop that is called fortouchstartandmousedown. Before a swipe even starts.- combined with
touchEventOptionsallows users the ability to now callpreventDefaultontouchstart
- combined with
- add new
onTouchEndOrOnMouseUpprop that is called fortouchendandmouseup. - add react 18 to
peerDependencies
Breaking Changes:
- we have dropped support for
es5transpiled output- we target
es2015for our transpilation nowswipeableutilizes object/array spread & const/let natively
- we target
preventScrollOnSwipe- "new" prop. ReplacespreventDefaultTouchmoveEvent- same functionality but renamed to be more explicit on its intended use
- fixed bug - where toggling this prop did not re-attach event listeners
- update - we now only change the
passiveevent listener option fortouchmovedepending on this prop- see notes in README for more details readme#passive-listener
- Thank you @stefvhuynh
Bug fixes:
- fix bug where directional swiped check allowed
undefined/falsy values to setcancelablePageSwipe - fix bug when both
trackTouchandtrackMousewere present that triggered an erroneous swipe when the user clicked outside and above the swipeable area
Infrastructure:
- post
size-limit reportto PRs with bundle diff sizes - utilize
rollupfor build & output - upgrade lots of dev dependencies
- 🎉 upgrade to
typescriptv4.6.3
- 🎉 upgrade to
- export/outputs housekeeping and cleaning (mimicked from
react-redux)- removed/renamed exports from
package.json:browser,umd:main(renameddist),jsnext:main(usemodule),typings(usetypes)
- moved exports - old => new
"main": "./dist/react-swipeable.js"=>"main": "./lib/index.js""module": "./dist/react-swipeable.module.js"=>"module": "es/index.js""types": "./dist/index.d.ts"=>"types": "./es/index.d.ts"
- removed/renamed exports from
v6.2.2
- add react v18 to
peerDependencies
v6.2.1
- Fix issue with some config properties being set to
undefinedbreaking swipeable
v6.2.0
deltaprop can now be anobjectspecifying different values for each direction- Maintenance
- upgrade to latest version of
microbundle- remove comments from built files
- attempt to lower size to counter unnecessary increase from
microbundleupgrade due torollupoutput.interop
- attempt to lower size to counter unnecessary increase from
- include type updates influenced by PR #259
- Thank you @jaketodaro
- remove comments from built files
- ~dependabot security updates~
- upgrade to latest version of
v6.1.2
- Maintenance
- actually include dependabot security updates
- update badge links
v6.1.1
- Maintenance
- ~dependabot security updates~
- Migrate to github actions, remove travis, update badges
- Update examples and provide link via codesandbox
v6.1.0
-
Add new event handler prop
onSwipeStart -
typescript updated to
v4.1.3and associated deps bumped to be compatible
v6.0.1
- Fix issue with
firstproperty onSwipeEventDataalways beingtrue.firstis now onlytruefor the first event, thenfalsefor subsequent events- issue #221 and PR #223
- Thank you @feketegy!
v6.0.0
New Features:
- include passive event listener option, by default, to internal uses of
addEventListener- solves issue with chrome and lighthouse - #167
- set
passivetofalseonly whenpreventDefaultTouchmoveEventistrue. - more details in readme#passive-listener-issue
- add new
onTapevent handler prop which executes its callback after a tap- Thank you @upatel32!
- add new
vxvyevent data property[ deltaX/time, deltaY/time]- velocity per axis- Thank you @upatel32!
Breaking Changes:
- remove
<Swipeable>component- see below for an example of how to make your own
- Swipeable component examples
- event data update correctly calculate
deltaXanddeltaY - drop support for ie11
- using
addEventListeneroptions object needs to be polyfilled, browser support
- using
- requires react >= 16.8.3, additionally supports new react v17
Bug fixes:
Infrastructure:
- typescript Converted entire code base, tests, and examples to typescript
- changed type
EventData->SwipeEventData- The event data provided for all swipe event callbacks - removed type
SwipeableOptions- useSwipeablePropsnow - removed types associated with
<Swipeable>component - new type
TapCallback- callback for the newonTapprop handler - new type
SwipeDirections-"Left" | "Right" | "Up" | "Down"
- changed type
- Converted tests to
@testing-library/react, react testing library - Build bundles with
microbundle. microbundle- export new "modern" build - via package.json
esmoduleproperty
- export new "modern" build - via package.json
Maintenance:
- Upgraded all dev dependencies,
jest,babel,webpack,eslint,prettier
5.5.0
- Add
firstproperty toeventDatathat istruefor first swipe event issue [#160] and PR [#162]- Thank you @samanpwbb!
5.4.0
- Add
initialproperty toeventDatathat supplies the inital[x, y]swipe value coordinates issue [#150] and PR [#131]
5.3.0
- Optimization for
useSwipeablehook. AddeduseMemofor handler internals issue [#134] and PR [#149]- Thank you @FaberVitale!
5.2.3
- Add check for
event.cancelablefortouchmoveevents before callingevent.preventDefault(), issue [#128] and PR [#145]- Thank you @maurispalletti!
5.2.2
- Fix typescript types for
ref, issue [#140] and PR [#142]- Thank you @mastermatt!
5.2.0
- Fix bug where callbacks/props were not refreshed for
useSwipeableand<Swipeable>, issue [#136] and PR [#138]- Thank you @caesarsol and @bas-l!
- Add typescript types for
useSwipeableand<Swipeable>, issue [#125]- Thank you @adambowles!
5.1.0
- Fix for
preventDefaultTouchmoveEventin safari issue [#127] and PR [#131]- Thank you @JiiB and @bhj!
- use
refcallback for both<Swipeable>anduseSwipeableto attach all touch event handlersuseSwipeable's returnedhandlersnow contains a ref callback- Please see disscusion and comments in both #127 and #131 for more details and info.
- fix avoids the
passive: trueissue from chrome document event listeners - fix avoids bug on safari where the
touchmoveevent listener needs to be attached before atouchstartin order to be able to calle.preventDefault
- fix avoids the
- removed
touchHandlerOptionprop- fix above deprecates this prop
5.0.0
- Introduce react hook,
useSwipeable - Core rewrite to simplify api and trim down bundled size
- Add
size-limitto help keep bundled size down - Add
esexport via"module": "es/index.js"topackage.json - Add
prettiercode formating - [BREAKING] simplify handler event data to allow destructuring
onSwiped = ({ event, direction, absX, absY, velocity}) => console.log('swiped')
- [BREAKING] deprecated
onSwiping{Left|Right|Up|Down}handler props- can be replaced with direction/
direvent data onSwiping = ({ dir }) => console.log(`swiping - ${dir}`)
- can be replaced with direction/
- [BREAKING] deprecated props
flickThresholdstopPropagationdisabled
- [BREAKING] deprecated passing "rest" of props down
- removed additional props besides the ones used by
<Swipeable>from being passed down- only
classNameandstyleget passed to<Swipeable>'s dom node, defaultdiv
- only
- removed additional props besides the ones used by
4.3.0
- Add
rotationAngleprop. #103- will allow to set a rotation angle, e.g. for a four-player game on a tablet, where each player has a 90° turned view.
- Thank you @Narquadah and @LarsKumbier!
4.2.2
- fixed bug that happened when if either
onSwipingoronSwipedwere set we were not callinge.preventDefault()appropriately
4.2.0
- Add support for calling
preventDefaulton Chrome 56+ via passive event support checking and manual event listener setup. #88- Thank you @kl0tl and @KrashStudio!
4.1.0
- add
disabledprop. #83 - add
innerRefprop that allows user to access to<Swipeable>'s inner dom node react ref. #82
4.0.1
- fixed bug where delta was causing a swipe to not be tracked correctly, [#74] , thanks @mctep
4.0.0
- Major Change
preventDefaultTouchmoveEventdefaults tofalsenow #69- This change is in part due to a Chrome56+ change
- Major Change drop support for React 12 & 13,
peerDependenciesupdated #64prop-typesadded todependencies#64
- Major Change
trackMousenow 'tracks' the swipe outside of the swipeable component, #67.- Thanks for example @TanaseHagi
- react 16 added to
peerDependencies
3.9.0
- add
onTapfunctionality. Thanks @anicke . #61 #39 - added persisting synthetic event in example via
e.persist(). This should help people see more details in the console when debugging in the [example](http://stack.formidable.com/react-swipeable/.
3.8.0
- Allow
onMouseDown,onMouseUp, andonMouseMoveprops to fire appropriately again. #55, thanks @lochstar - Stop using this.state to track swipes, thanks @grantila for pointing out this change and submitting PR, #58. Should provide minor performance gains since
Swipeablewill no longer be callingthis.setStateinternally.
3.7.0
- add ability to track mouse events as touch events. Thanks @jakepusateri and @Marcel-G. #51
3.6.0
- add stopPropagation prop for all swipe events, defaults to
false. See #46 for more info.
3.5.1
- fix React 15.2.0 warning for unknown properties on DOM elements
3.5.0
- Add configurable container element via
nodeNameprop, defaults to'div'. See #24 and #40 for more info.
3.4.0
- Add preventDefault while swiping when props
onSwipedLeft,onSwipedRight,onSwipedUp, andonSwipedDownare present. See #21 and #37 for more info.
3.3.0
- Adds
velocitydata toonSwipingcallback - Updated the build process introducing ES2015 and babel
3.2.0
- Adds
preventDefaultTouchMoveEventoption, defaults to true
3.1.0
- Adds
isFLickto onSwipe events - Removes React as a peer dep
- Adds onSwiping events
3.0.2
- Fixes onSwipeDown and onSwipeUp events
3.0.1
- Fixes vertical swiping
3.0.0
- Refactors build into jsx.
2.1.0
- Adds onSwipedUp, onSwipedRight, onSwipedDown, onSwipedLeft callbacks.
2.0
-
onFlickprop has been removed. -
onSwipenow has a 4th argument for the callbackBoolean isFlick -
Added a prop
flickThresholdwhich allows you to customize at what velocity a flick is detected.