Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bde7b60

Browse files
committedSep 10, 2022
[Beta] Avoid grey screen on Safari iOS swipe
1 parent 7e8447a commit bde7b60

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎beta/src/pages/_app.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ if (typeof window !== 'undefined') {
2525

2626
export default function MyApp({Component, pageProps}: AppProps) {
2727
const router = useRouter();
28+
29+
React.useEffect(() => {
30+
// This is kind of a lie.
31+
// We still rely on the manual Next.js scrollRestoration logic.
32+
// However, we *also* don't want Safari grey screen during the back swipe gesture.
33+
// Seems like it doesn't hurt to enable auto restore *and* Next.js logic at the same time.
34+
history.scrollRestoration = 'auto';
35+
}, []);
36+
2837
React.useEffect(() => {
2938
const handleRouteChange = (url: string) => {
3039
ga('set', 'page', url);

0 commit comments

Comments
 (0)
Please sign in to comment.