diff --git a/front/src/App.tsx b/front/src/App.tsx index 5a221c0..63b7370 100644 --- a/front/src/App.tsx +++ b/front/src/App.tsx @@ -1,3 +1,5 @@ +import { useEffect } from 'react'; + import { ErrorBoundary } from '@/errors/ErrorBoundary'; import { AudioPlayer } from './components'; @@ -6,6 +8,19 @@ import { AppRoutes } from './scene/AppRoutes'; import { ServiceContextProvider } from './service/ServiceContext'; export const App = () => { + // Prevent reload the page when scroll on mobile + useEffect(() => { + const preventRefresh = (event: { preventDefault: () => void }) => { + if (window.scrollY === 0) { + event.preventDefault(); + } + }; + document.addEventListener('touchmove', preventRefresh, { passive: false }); + return () => { + document.removeEventListener('touchmove', preventRefresh); + }; + }, []); + return (