Skip to content

Commit c1aba6c

Browse files
committed
ios: fix safe area
1 parent 76c08cf commit c1aba6c

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

frontends/ios/BitBoxApp/BitBoxApp/WebView.swift

+4
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ struct WebView: UIViewRepresentable {
128128
let webView = WKWebView(frame: .zero, configuration: config)
129129
webView.navigationDelegate = context.coordinator
130130
webView.uiDelegate = context.coordinator
131+
132+
// Disables automatic content inset adjustment to prevent safe area issues
133+
// https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior-swift.property
134+
webView.scrollView.contentInsetAdjustmentBehavior = .never
131135

132136
setHandlers.setMessageHandlers(handlers: MessageHandlers(webView: webView))
133137
let source = """

frontends/web/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
66
<meta name="theme-color" content="#000000" />
77
<title>BitBoxApp</title>
88
</head>
99
<body>
1010
<div id="root"></div>
1111
<script type="module" src="/src/index.tsx"></script>
1212
</body>
13-
</html>
13+
</html>

frontends/web/src/app.module.css

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
min-width: 0;
77
/* mobile viewport bug fix */
88
max-height: -webkit-fill-available;
9+
/* iOS safe area handling */
10+
padding-top: env(safe-area-inset-top, 0);
11+
padding-left: env(safe-area-inset-left, 0);
12+
padding-right: env(safe-area-inset-right, 0);
913
}
1014

1115
@media (max-width: 900px) {

frontends/web/src/components/dialog/dialog.module.css

+5-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@
5858
}
5959

6060
.header {
61-
height: var(--item-height);
6261
display: flex;
6362
flex-direction: row;
6463
justify-content: space-between;
6564
align-items: center;
66-
padding: 0 var(--space-half);
65+
padding: 13.5px var(--space-half);
66+
padding-top: calc(13.5px + env(safe-area-inset-top, 0));
6767
border-bottom: solid 1px var(--background);
6868
}
6969

@@ -212,6 +212,9 @@
212212
font-size: var(--header-default-font-size);
213213
}
214214

215+
.header {
216+
}
217+
215218
.modal {
216219
padding: 0;
217220
}

frontends/web/src/components/dropdown/mobile-fullscreen-selector.module.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
background-color: var(--background);
5050
cursor: default;
5151
display: flex;
52-
height: var(--item-height);
53-
padding: 0 var(--space-half);
52+
padding: 13.5px var(--space-half);
53+
padding-top: calc(13.5px + env(safe-area-inset-top, 0));
5454
position: relative;
5555
}
5656

frontends/web/src/components/guide/guide.module.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
.header {
5252
background-color: var(--color-blue);
5353
flex-shrink: 0;
54-
height: var(--header-height);
55-
padding: 0 var(--space-default);
54+
padding: 23px var(--space-default);
55+
padding-top: calc(23px + env(safe-area-inset-top, 0));
5656
}
5757

5858
.header h2 {
@@ -71,6 +71,7 @@
7171
flex-direction: column;
7272
flex-grow: 1;
7373
padding: 0 var(--space-default);
74+
padding-bottom: env(safe-area-inset-bottom, 0);
7475
}
7576

7677
.content h1 {

0 commit comments

Comments
 (0)