Remove edge resistance when sidebar swipe is enabled
Makes swiping to open sidebar feel natural without resistance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -295,7 +295,9 @@ export function SwipeTabs<T extends string | number>({
|
||||
let offset = dx;
|
||||
const atStart = state.startIndex <= 0;
|
||||
const atEnd = state.startIndex >= tabs.length - 1;
|
||||
if ((atStart && dx > 0) || (atEnd && dx < 0)) {
|
||||
// Don't apply resistance at start if onSwipePastStart is defined (sidebar can open)
|
||||
const hasVirtualTabAtStart = !!onSwipePastStart;
|
||||
if ((atStart && dx > 0 && !hasVirtualTabAtStart) || (atEnd && dx < 0)) {
|
||||
offset = dx * EDGE_RESISTANCE;
|
||||
}
|
||||
offset = Math.max(Math.min(offset, width), -width);
|
||||
@@ -306,7 +308,7 @@ export function SwipeTabs<T extends string | number>({
|
||||
preventDefault();
|
||||
}
|
||||
},
|
||||
[scheduleDragUpdate, tabs.length]
|
||||
[onSwipePastStart, scheduleDragUpdate, tabs.length]
|
||||
);
|
||||
|
||||
const finishDrag = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user