Skip to content

Commit 60138c3

Browse files
authoredMar 25, 2025
fix: viewport issue with safe area (#568)
1 parent 0eb8a79 commit 60138c3

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed
 

‎src/app/Document.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ export const Document = ({ children }: { children: ReactNode }) => {
1818
return (
1919
<html lang={locale?.lang} dir={locale?.dir}>
2020
<head>
21-
<meta
22-
name="viewport"
23-
content="width=device-width,initial-scale=1,viewport-fit=cover"
24-
/>
2521
<meta
2622
name="apple-mobile-web-app-status-bar-style"
2723
content="black-translucent"

‎src/app/layout.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ReactNode } from 'react';
22

3-
import { Metadata } from 'next';
3+
import { Metadata, Viewport } from 'next';
44

55
import { Document } from '@/app/Document';
66
import { NextLoader } from '@/app/NextLoader';
@@ -15,6 +15,12 @@ export const metadata: Metadata = {
1515
description: 'Opinionated UI starter',
1616
};
1717

18+
export const viewport: Viewport = {
19+
width: 'device-width',
20+
initialScale: 1,
21+
viewportFit: 'cover',
22+
};
23+
1824
export default async function RootLayout({
1925
children,
2026
}: {

‎src/components/Viewport/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const Viewport = (props: FlexProps) => {
1212
// Allows new units used if supported
1313
style={{
1414
maxWidth: '100dvw',
15-
minHeight: '100dvh',
15+
minHeight: '100lvh',
1616
}}
1717
{...props}
1818
/>

‎src/features/app/AppLayoutPage.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const AppLayoutPage = ({
7373
<AppLayoutPageContext.Provider value={value}>
7474
<Flex
7575
position="relative"
76-
pt="safe-top"
7776
as={Scrollbars}
7877
direction="column"
7978
flex={1}
@@ -86,7 +85,7 @@ export const AppLayoutPage = ({
8685
}}
8786
{...rest}
8887
>
89-
<PageContainer pt={4} pb={16} {...containerProps}>
88+
<PageContainer mt="safe-top" pt={4} pb={16} {...containerProps}>
9089
{children}
9190
</PageContainer>
9291
<Box w="full" h="0" pb="safe-bottom" />

0 commit comments

Comments
 (0)