-
Hi! const handlers = useSwipeable({
onSwiped: (eventData) => console.log("User Swiped!", eventData),
});
return (
<Calendar
{...handlers}
onChange={onChange}
value={value}
/>
); Is there any way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
React-Calendar accepts If you rename If you're thinking what I'm thinking, here's how to implement switching views with swipe. You'll need to have Please note that we're hacking |
Beta Was this translation helpful? Give feedback.
-
@wojtekmaj is there a chance to get this implemented in react-calendar package? |
Beta Was this translation helpful? Give feedback.
React-Calendar accepts
ref
, butref
points toCalendar
component and its internals, and not the wrapper rendered byCalendar
.handlers
returned byuseSwipeable
is just{ ref }
from what I can see, and I assumeref
expects to be hooked to a DOM element, not React component. That's why it doesn't work.If you rename
ref
toinputRef
inhandlers
, it works!https://codesandbox.io/s/react-calendar-react-swipeable-kxw92
If you're thinking what I'm thinking, here's how to implement switching views with swipe. You'll need to have
activeStartDate
andview
controlled so thatonSwiped
has some data to begin with.https://codesandbox.io/s/react-calendar-react-swipeable-change-view-on-swipe-f0p4i
Pleas…