Files
AFFiNE-Mirror/packages/frontend/apps/ios/src/web-navigation-control.tsx
CatsJuice 0acdf62043 refactor(ios): disable navigation gesture with js (#9287)
Do not toggle navigation gesture native to avoid unexpected behavior. close AF-1958, AF-1797
2024-12-25 04:27:51 +00:00

14 lines
381 B
TypeScript

import { LiveData } from '@toeverything/infra';
export const enableNavigationGesture$ = new LiveData(false);
const onTouchStart = (e: TouchEvent) => {
if (enableNavigationGesture$.value) return;
const clientX = e.changedTouches[0].clientX;
if (clientX <= 25) {
e.preventDefault();
}
};
document.body.addEventListener('touchstart', onTouchStart, { passive: false });