Make webview transparent to fix flash-of-white when in dark mode. Fixes #5587.

This commit is contained in:
Brent Simmons committed 2026-12-04 14:29:20 -08:00
1 parent 5c50d7b97d
commit 545b8ebb64
2 files changed
+9

No files matched your search

+5
View File
@@ -20,6 +20,11 @@ final class PreloadedWebView: WKWebView {
super.init(frame: .zero, configuration: configuration)
isInspectable = true
isFindInteractionEnabled = true
// Transparent so a page sliding in shows its view’s background, not white, until it paints.
// <https://github.com/Ranchero-Software/NetNewsWire/issues/5587>
isOpaque = false
backgroundColor = .clear
scrollView.backgroundColor = .clear
fullscreenStateObservation = observe(\.fullscreenState, options: []) { [weak self] _, _ in
Task { @MainActor in
guard let self else {
+4
View File
@@ -93,6 +93,10 @@ final class WebViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Shows through the transparent web view until the article paints.
// <https://github.com/Ranchero-Software/NetNewsWire/issues/5587>
view.backgroundColor = .systemBackground
NotificationCenter.default.addObserver(self, selector: #selector(handleFeedIconImageDidChange(_:)), name: .feedIconImageDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleGrayscaleIconsDidChange(_:)), name: .grayscaleIconsDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleAuthorAvatarImageDidChange(_:)), name: .authorAvatarImageDidChange, object: nil)