1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-19 21:46:50 -04:00

Fixed: Sidebar flickering on mobile

This commit is contained in:
Bogdan
2025-04-28 11:56:16 +03:00
parent 704d920dab
commit 65a532a7fd
@@ -363,34 +363,37 @@ function PageSidebar({ isSidebarVisible, isSmallScreen }: PageSidebarProps) {
}); });
}, []); }, []);
const handleTouchEnd = useCallback((event: TouchEvent) => { const handleTouchEnd = useCallback(
const touches = event.changedTouches; (event: TouchEvent) => {
const currentTouch = touches[0].pageX; const touches = event.changedTouches;
const currentTouch = touches[0].pageX;
if (!touchStartX.current) { if (!touchStartX.current) {
return; return;
} }
if (currentTouch > touchStartX.current && currentTouch > 50) { if (currentTouch > touchStartX.current && currentTouch > 50) {
setSidebarTransform({ setSidebarTransform({
transition: 'none', transition: 'none',
transform: 0, transform: 0,
}); });
} else if (currentTouch < touchStartX.current && currentTouch < 80) { } else if (currentTouch < touchStartX.current && currentTouch < 80) {
setSidebarTransform({ setSidebarTransform({
transition: 'transform 50ms ease-in-out', transition: 'transform 50ms ease-in-out',
transform: SIDEBAR_WIDTH * -1, transform: SIDEBAR_WIDTH * -1,
}); });
} else { } else {
setSidebarTransform({ setSidebarTransform({
transition: 'none', transition: 'none',
transform: 0, transform: isSidebarVisible ? 0 : SIDEBAR_WIDTH * -1,
}); });
} }
touchStartX.current = null; touchStartX.current = null;
touchStartY.current = null; touchStartY.current = null;
}, []); },
[isSidebarVisible]
);
const handleTouchCancel = useCallback(() => { const handleTouchCancel = useCallback(() => {
touchStartX.current = null; touchStartX.current = null;