You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@simonflk Thank you for the detailed issue and example codesandbox, i greatly appreciate it, so helpful to see the issue and try it out.
Thank you for also identifying the culprit. These config values types do call out undefined as a valid type. I'll work on a bug fix for this tonight with a test for undefined for all config values. Something similar was also identified recently, #240 (comment) .
My workaround for now is to rather default delta to {}.
May I suggest defaulting to 0 instead? It's a bit more inline as a default.
Describe the bug
Using
useSwipeable()
with an explicitdelta: undefined
, will cause an exception since v6.2.0:Results in this error (when swiping):
Steps or Sandbox to reproduce
See the following example:
https://codesandbox.io/s/react-swipeable-image-carousel-forked-obuesx?file=/src/index.js
I have modified the
Carousel
component to accept a prop which is passed asdelta
touseSwipeable
Expected behavior
Either the default
delta
should be applied, or the handlers should not be attached.** Device/Browser **
Chrome 98, macOS
Additional context
Error occurs in 6.2.0, but not in earlier versions.
Seems to be a bug introduced in #260 (expecting that
delta
is either a number or an object)And also #185 (setting the props like so):
My workaround for now is to rather default delta to
{}
.The text was updated successfully, but these errors were encountered: