Fix white flash in dark mode

This commit is contained in:
Jed Fox 2022-12-03 11:27:51 -05:00
parent 7944ec6399
commit c67e6ce45e
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
1 changed files with 6 additions and 2 deletions

View File

@ -241,9 +241,11 @@ extension StatusCardControl {
fileprivate func showWebView() {
let webView = setupWebView()
webView.loadHTMLString("<meta name='viewport' content='width=device-width,user-scalable=no'><style>body { margin: 0; color-scheme: light dark; } body > :only-child { width: 100vw !important; height: 100vh !important }</style>" + html, baseURL: nil)
if webView.superview == nil {
addSubview(webView)
webView.pinTo(to: imageView)
}
}
}
extension StatusCardControl: WKNavigationDelegate, WKUIDelegate {
@ -259,6 +261,8 @@ extension StatusCardControl: WKNavigationDelegate, WKUIDelegate {
webView.uiDelegate = self
webView.navigationDelegate = self
webView.translatesAutoresizingMaskIntoConstraints = false
webView.isOpaque = false
webView.backgroundColor = .clear
self.webView = webView
return webView
}