diff --git a/packages/vkui/src/components/AppRoot/ScrollContext.tsx b/packages/vkui/src/components/AppRoot/ScrollContext.tsx index d96d8eedcd..6aa3b82d1f 100644 --- a/packages/vkui/src/components/AppRoot/ScrollContext.tsx +++ b/packages/vkui/src/components/AppRoot/ScrollContext.tsx @@ -61,12 +61,18 @@ export const useScroll = (): ScrollContextInterface => React.useContext(ScrollCo * Если счетчик больше нуля, требуется заблокировать прокрутку */ function useScrollLockController(enableScrollLock: () => void, disableScrollLock: () => void) { + const isFirstEffect = React.useRef(true); const [count, { increment: incrementScrollLockCounter, decrement: decrementScrollLockCounter }] = useCounter(0); const needLockScroll = count > 0; React.useEffect(() => { + if (isFirstEffect.current) { + isFirstEffect.current = false; + return; + } + if (needLockScroll) { enableScrollLock(); } else {