Skip to content

Commit

Permalink
Tune gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Dec 10, 2024
1 parent d7fc542 commit d356d7c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/view/shell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ function ShellInner() {
configureGestureHandler={handler => {
if (swipeEnabled) {
if (isDrawerOpen) {
// You probably want to close it so activate on smallest pans.
return handler.activeOffsetX([-1, 1])
} else {
// Disambiguate the drawer swipe from the pager swipe.
return (
handler
// Any finger movement to the right activates it
.activeOffsetX(1)
// Any finger movement to the left insta-fails it
// Any movement to the left is a pager swipe
// so fail the drawer gesture immediately.
.failOffsetX(-1)
// Don't rush declaring that a movement to the right
// is a drawer swipe. It could be a vertical scroll.
.activeOffsetX(5)
)
}
} else {
Expand All @@ -125,6 +125,8 @@ function ShellInner() {
onOpen={onOpenDrawer}
onClose={onCloseDrawer}
swipeEdgeWidth={winDim.width}
swipeMinVelocity={100}
swipeMinDistance={10}
drawerType={isIOS ? 'slide' : 'front'}
overlayStyle={{
backgroundColor: select(t.name, {
Expand Down

0 comments on commit d356d7c

Please sign in to comment.