fix: scrolling on swiping to open menu

This commit is contained in:
sk1982 2024-04-07 02:48:23 -04:00
parent b1ea855986
commit b0590c81f2

View File

@ -73,6 +73,7 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => {
setMenuTranslate(null);
setNotificationsTranslate(null);
document.body.classList.remove('touch-none', 'overflow-hidden');
},
onSwipeStart: e => {
if (e.dir === 'Down' || e.dir === 'Up') return;
@ -97,9 +98,11 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => {
if ((isMenuOpen && e.dir === 'Left') || (allMenusClosed && e.dir === 'Right' && xPercent <= 0.6)) {
setMenuTranslate(e.deltaX);
e.event.preventDefault();
document.body.classList.add('touch-none', 'overflow-hidden');
} else if ((isNotificationsOpen && e.dir === 'Right' || (allMenusClosed && e.dir === 'Left' && xPercent >= 0.4))) {
setNotificationsTranslate(e.deltaX);
e.event.preventDefault();
document.body.classList.add('touch-none', 'overflow-hidden');
}
},
onSwiping: e => {