mirror of
https://github.com/sartoopjj/thefeed.git
synced 2026-05-19 04:34:36 +03:00
fix: adjust background color and scroll view insets for improved layout
This commit is contained in:
@@ -5,10 +5,15 @@ struct ContentView: View {
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
// Background fills the notch + home-indicator area with the
|
||||
// same color as the page so there's no visible band; the
|
||||
// WebView itself stays *inside* the safe area so the page's
|
||||
// CSS env(safe-area-inset-*) returns 0 and we don't end up
|
||||
// double-padding (system inset + body padding).
|
||||
Color(red: 0.07, green: 0.09, blue: 0.13).ignoresSafeArea()
|
||||
if server.port > 0 {
|
||||
WebView(url: URL(string: "http://127.0.0.1:\(server.port)")!)
|
||||
.ignoresSafeArea()
|
||||
.ignoresSafeArea(.keyboard)
|
||||
} else if let err = server.lastError {
|
||||
VStack(spacing: 12) {
|
||||
Text("startup failed").font(.headline).foregroundColor(.white)
|
||||
|
||||
@@ -19,6 +19,12 @@ struct WebView: UIViewRepresentable {
|
||||
let view = WKWebView(frame: .zero, configuration: cfg)
|
||||
view.allowsBackForwardNavigationGestures = true
|
||||
view.scrollView.bounces = true
|
||||
// Don't double-pad the bottom: the page already adds
|
||||
// env(safe-area-inset-bottom) via CSS; the WebView's automatic
|
||||
// content inset would stack on top and leave a huge gap.
|
||||
view.scrollView.contentInsetAdjustmentBehavior = .never
|
||||
view.scrollView.contentInset = .zero
|
||||
view.scrollView.scrollIndicatorInsets = .zero
|
||||
view.navigationDelegate = context.coordinator
|
||||
context.coordinator.webView = view
|
||||
|
||||
|
||||
Reference in New Issue
Block a user