Make preventScrollOnSwipe option more configurable with a function#361
Open
okcoker wants to merge 5 commits intoFormidableLabs:mainfrom
Open
Make preventScrollOnSwipe option more configurable with a function#361okcoker wants to merge 5 commits intoFormidableLabs:mainfrom
preventScrollOnSwipe option more configurable with a function#361okcoker wants to merge 5 commits intoFormidableLabs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 36fb9c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
preventScrollOnSwipe option more configurablepreventScrollOnSwipe option more configurable with a function
Collaborator
|
initial glance and thoughts are this is awesome! i'm now having vague memories of also thinking about this a long time ago 🤔 and seen in similar libraries. Going to look through old issues and notes 👀 the backwards compatibility is ⭐️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This may be something that would inherently be able to fix #275, but in my application, I use this for a carousel component. We noticed when swiping on the carousel, the page would scroll which was a bit undesirable. I eventually added
preventScrollOnSwipe, but this made scrolling the page very hard because our carousels may take up a decent amount of the screen real estate.We would like to prevent scrolling only when a swipe on the x-axis is in progress. I considered making
preventScrollOnSwipehave a type ofboolean | 'vertical' | 'horizontal'but ultimately landed on this change which should allow for any custom functionality one might want before callingevent.preventDefault().Type of Change
How Has This Been Tested?
Tested by linking this node module in my project, and using the function. Also wrote unit tests.
Checklist: (Feel free to delete this section upon completion)