Skip to content

Commit

Permalink
Prevent pull to refresh gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
WITS committed Feb 9, 2024
1 parent f1810ba commit 80df3be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ function Root({
}, 300);

setTimeout(() => {
// reset(document.documentElement, 'scrollBehavior');
reset(document.documentElement, 'scrollBehavior');
reset(document.documentElement, 'overscrollBehavior');
reset(document.body, 'overscrollBehavior');
if (snapPoints) {
setActiveSnapPoint(snapPoints[0]);
}
Expand Down Expand Up @@ -560,6 +562,10 @@ function Root({
if (isOpen) {
set(document.documentElement, {
scrollBehavior: 'auto',
overscrollBehavior: 'none',
});
set(document.body, {
overscrollBehavior: 'none',
});

openTime.current = new Date();
Expand Down Expand Up @@ -587,8 +593,10 @@ function Root({

if (open) {
// setting original styles initially
reset(document.body, 'overscrollBehavior');
set(document.body, {
background: document.body.style.backgroundColor || document.body.style.background,
overscrollBehavior: 'none',
});
// setting body styles, with cache ignored, so that we can get correct original styles in reset
set(
Expand Down

0 comments on commit 80df3be

Please sign in to comment.