set navBarHeight in one place

This commit is contained in:
Satindar Dhillon 2022-02-23 21:24:05 -08:00
parent 201576ec7a
commit 6a41484bca
3 changed files with 5 additions and 4 deletions

View file

@ -180,7 +180,7 @@ struct LinkItemDetailView: View {
.padding(.horizontal)
.scaleEffect(navBarVisibilityRatio)
}
.frame(height: LinkItemDetailView.navBarHeight * navBarVisibilityRatio)
.frame(height: readerViewNavBarHeight * navBarVisibilityRatio)
.opacity(navBarVisibilityRatio)
.background(Color.systemBackground)
}

View file

@ -3,6 +3,8 @@ import SwiftUI
import Utils
import WebKit
public let readerViewNavBarHeight = 50.0
#if os(iOS)
struct WebAppView: UIViewRepresentable {
let request: URLRequest
@ -34,8 +36,8 @@ import WebKit
webView.backgroundColor = UIColor.clear
webView.configuration.userContentController = contentController
webView.scrollView.delegate = context.coordinator
webView.scrollView.contentInset.top = 50.0 // TODO: LinkItemDetailView.navBarHeight
webView.scrollView.verticalScrollIndicatorInsets.top = 50.0 // TODO: LinkItemDetailView.navBarHeight
webView.scrollView.contentInset.top = readerViewNavBarHeight
webView.scrollView.verticalScrollIndicatorInsets.top = readerViewNavBarHeight
for action in WebViewAction.allCases {
webView.configuration.userContentController.add(context.coordinator, name: action.rawValue)

View file

@ -2,7 +2,6 @@ import SwiftUI
import WebKit
final class WebAppViewCoordinator: NSObject {
let navBarHeight = 50.0 // TODO: LinkItemDetailView.navBarHeight
var webViewActionHandler: (WKScriptMessage) -> Void = { _ in }
var linkHandler: (URL) -> Void = { _ in }
var needsReload = true