Skip to content

Commit

Permalink
Merge pull request #40201 from suneox/40076-update-adjust-viewport
Browse files Browse the repository at this point in the history
40076 update adjust viewport

(cherry picked from commit eef5fde)
  • Loading branch information
madmax330 authored and OSBotify committed Apr 16, 2024
1 parent 1e13582 commit 4971d15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useViewportOffsetTop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function useViewportOffsetTop(shouldAdjustScrollView = false): nu

if (Browser.isMobileSafari() && shouldAdjustScrollView && window.visualViewport) {
const clientHeight = document.body.clientHeight;
const adjustScrollY = Math.round(clientHeight - window.visualViewport.height);
const adjustScrollY = clientHeight - window.visualViewport.height;
if (cachedDefaultOffsetTop.current === 0) {
cachedDefaultOffsetTop.current = targetOffsetTop;
}
Expand All @@ -43,7 +43,7 @@ export default function useViewportOffsetTop(shouldAdjustScrollView = false): nu
if (!shouldAdjustScrollView) {
return;
}
window.scrollTo({top: viewportOffsetTop, behavior: 'instant'});
window.scrollTo({top: viewportOffsetTop, behavior: 'smooth'});
}, [shouldAdjustScrollView, viewportOffsetTop]);

return viewportOffsetTop;
Expand Down

0 comments on commit 4971d15

Please sign in to comment.