-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent scroll prop #240
Prevent scroll prop #240
Conversation
Any progress on this? |
It's on my mind 😸 . It will be a major version change so i'm seeing what else we can/should get in like #267 |
@hartzis I am running into the need for this in our implementation, and the example given here is exactly what I am trying to accomplish. Scrollable list of swipeable items that expose additional options, a la a mobile to do list or something similar. Looking at the documentation you referenced for use-gesture, it seems that in conjunction with setting |
Thank you all for your work on this awesome library. There's a tangential issue I ran into that maybe this PR can address: In trying to create a generic
I noticed that the |
@bhj thanks for the feedback, curious what you mean by |
Given my example So, in this conditional:
The third check is doing something very different from the first two. I think it should check whether the properties' values are actually defined, like the first two, rather than simply whether or not the properties exist. |
yup, lol. welp that's been hiding in there for a while 😬 @bhj Thank you for pointing that out, apologies for not fully grasping what you were getting at before. We'll get this fixed in the next version for sure 👍 |
src/index.ts
Outdated
props.onSwiping && props.onSwiping(eventData); | ||
|
||
// track if a swipe is cancelable(handler for swiping or swiped(dir) exists) | ||
// track if a swipe is cancelable (handler for swiping or swiped(dir) exists) | ||
// so we can call preventDefault if needed | ||
let cancelablePageSwipe = false; | ||
if (props.onSwiping || props.onSwiped || `onSwiped${dir}` in props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (props.onSwiping || props.onSwiped || `onSwiped${dir}` in props) { | |
if (props.onSwiping || props.onSwiped || props[`onSwiped${dir}`]) { |
📓 NOTE to @hartzis fix this and add test for { onSwipedLeft: undefined }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- added fix! and documented in changelog
size-limit report 📦
|
* Replace microbundle with rollup (#273) * Prevent scroll prop (#240) * update changelog with callouts * update format, fix lint config issue, update contributing * set ts output target to es2015, update changelog * add comments to types for more info (#293) * setup touchEventOptions prop (#290) * setup touchEventOptions prop * add onTouchStartOrOnMouseDown prop and test * add onTouchEndOrOnMouseUp callback * Feature swipeDuration (#291) * update docs and migration * 7.0.0-alpha.0 * update deps, add react 18 peer * 7.0.0-alpha.1 * update examples to use react 18 * update deps, update LICENSE dates * update readme, types, example types * export/outputs housekeeping and cleaning * 7.0.0-alpha.2 * fix issue #304 * 7.0.0-alpha.3 * bump deps Co-authored-by: Binoy <me@binoy.io> Co-authored-by: Stefan Huynh <stefan.huynh@formidable.com> Co-authored-by: Brian Emil Hartz <brianhartz@gmail.com>
preventDefaultTouchmoveEvent
topreventScrollOnSwipe
touchmove
whenpreventScrollOnSwipe
istrue
preventScrollOnSwipe
value changes (fixes the main example)TODO before merge
passive: true
ontouchstart
andtouchend
. We need to decide what these should be and if we should introduce aneventOptions
object to allow users to set these themselves.