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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user