File tree 5 files changed +27
-13
lines changed
5 files changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,10 @@ struct WebView: UIViewRepresentable {
128
128
let webView = WKWebView ( frame: . zero, configuration: config)
129
129
webView. navigationDelegate = context. coordinator
130
130
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
131
135
132
136
setHandlers. setMessageHandlers ( handlers: MessageHandlers ( webView: webView) )
133
137
let source = """
Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
- < head >
4
- < meta charset ="utf-8 " />
5
- < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
6
- < meta name ="theme-color " content ="#000000 " />
7
- < title > BitBoxApp</ title >
8
- </ head >
9
- < body >
10
- < div id ="root "> </ div >
11
- < script type ="module " src ="/src/index.tsx "> </ script >
12
- </ body >
13
- </ html >
3
+
4
+ < head >
5
+ < meta charset ="utf-8 " />
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1, viewport-fit=cover " />
7
+ < meta name ="theme-color " content ="#000000 " />
8
+ < title > BitBoxApp</ title >
9
+ </ head >
10
+
11
+ < body >
12
+ < div id ="root "> </ div >
13
+ < script type ="module " src ="/src/index.tsx "> </ script >
14
+ </ body >
15
+
16
+ </ html >
Original file line number Diff line number Diff line change 6
6
min-width : 0 ;
7
7
/* mobile viewport bug fix */
8
8
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 );
9
13
}
10
14
11
15
@media (max-width : 900px ) {
Original file line number Diff line number Diff line change 51
51
.header {
52
52
background-color : var (--color-blue );
53
53
flex-shrink : 0 ;
54
- height : var (--header-height );
55
- padding : 0 var ( --space-default );
54
+ padding : 23 px var (--space-default );
55
+ padding-top : calc ( 23 px + env (safe-area-inset-top , 0 ) );
56
56
}
57
57
58
58
.header h2 {
71
71
flex-direction : column;
72
72
flex-grow : 1 ;
73
73
padding : 0 var (--space-default );
74
+ padding-bottom : env (safe-area-inset-bottom, 0 );
74
75
}
75
76
76
77
.content h1 {
Original file line number Diff line number Diff line change 103
103
104
104
/* guide */
105
105
--guide-width : 350px ;
106
+
107
+ /* iOS viewport height variable */
106
108
}
107
109
108
110
: root ,
You can’t perform that action at this time.
0 commit comments