Skip to content

Commit

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

40076 update adjust viewport
  • Loading branch information
madmax330 authored Apr 16, 2024
2 parents 90412ec + 021d945 commit eef5fde
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 eef5fde

Please sign in to comment.