Skip to content
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

feature request: with snap points, make high-velocity behavior optional #333

Open
artemis-prime opened this issue Apr 25, 2024 · 0 comments

Comments

@artemis-prime
Copy link
Contributor

Currently, if the drawer is swiped quickly, it will always pass snap points and close / open fully. There are many use cases where this is undesirable (snap points have specific meanings or other state effects and should always be passed-through). This would be a very easy change. We could have an alwaysSnapToNextPoint optional prop or some such thing

// use-snap-points.ts:152

    if (!alwaysSnapToNextPoint && velocity > 2 && !hasDraggedUp) {
      if (dismissible) closeDrawer();
      else snapToPoint(snapPointsOffset[0]); // snap to initial point
      return;
    }

    if (!alwaysSnapToNextPoint && velocity > 2 && hasDraggedUp && snapPointsOffset && snapPoints) {
      snapToPoint(snapPointsOffset[snapPoints.length - 1] as number);
      return;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant