fix(sidebar): use fast fade instead of slide when navigating

Slide animation freezes halfway when navigation starts. Now uses
instant snap + 100ms backdrop fade for agent selection. Gestures
still use the slide animation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2026-01-03 21:55:40 +07:00
parent 75895b17d4
commit 7b55740a9e

View File

@@ -93,17 +93,15 @@ export function SlidingSidebar({ selectedAgentId }: SlidingSidebarProps) {
}, []);
// Mobile: close sidebar when agent is selected
// Use a quick fade instead of slide since navigation interrupts the animation
const handleAgentSelectMobile = useCallback(() => {
// Start animation immediately, don't wait for useEffect
translateX.value = withTiming(-windowWidth, {
duration: ANIMATION_DURATION,
easing: ANIMATION_EASING,
});
// Fast fade out - slide animations freeze during navigation
backdropOpacity.value = withTiming(0, {
duration: ANIMATION_DURATION,
duration: 100,
easing: ANIMATION_EASING,
});
close(); // Update state for consistency
translateX.value = -windowWidth; // Snap immediately
close();
}, [close, translateX, backdropOpacity, windowWidth]);
// Close gesture (swipe left to close when sidebar is open)