mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Make sure the Tab Rail's background matches the split view's detail background. (#6003)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// The reported background drawn by a view.
|
||||
public enum CompoundBackground: Equatable {
|
||||
/// A specific background colour.
|
||||
case color(Color)
|
||||
/// The default canvas background.
|
||||
case `default`
|
||||
|
||||
public var colorValue: Color {
|
||||
switch self {
|
||||
case .color(let color): color
|
||||
case .default: .compound.bgCanvasDefault
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A background reported up the hierarchy by a view that opts in, so that surrounding chrome (e.g. the
|
||||
/// tab rail that sits alongside iOS 26's inset sidebar) can match that view's canvas.
|
||||
public struct CompoundBackgroundPreferenceKey: PreferenceKey {
|
||||
public static let defaultValue: CompoundBackground? = nil
|
||||
|
||||
public static func reduce(value: inout CompoundBackground?, nextValue: () -> CompoundBackground?) {
|
||||
if let nextValue = nextValue() {
|
||||
value = nextValue
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,13 @@ public extension View {
|
||||
environment(\.defaultMinListRowHeight, 48)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.compound.bgSubtleSecondaryLevel0.ignoresSafeArea())
|
||||
.preference(key: CompoundBackgroundPreferenceKey.self, value: .color(.compound.bgSubtleSecondaryLevel0))
|
||||
case .plain:
|
||||
listStyle(.plain)
|
||||
.environment(\.defaultMinListRowHeight, 48)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.preference(key: CompoundBackgroundPreferenceKey.self, value: .default)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user