Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions resources/ios/NativeUIListItemRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ struct NativeUIListItemRenderer: View {
.padding(.vertical, 12)
.background(containerColor != 0 ? Color(argb: containerColor) : Color.clear)
.opacity(disabled ? 0.5 : 1.0)
// Without an explicit content shape, onTapGesture only registers on
// opaque pixels — the padding and the Spacer gap between text and
// trailing content (most of the row) are tap-dead. Make the whole
// row bounds hittable before attaching @tap / @longPress handlers.
.contentShape(Rectangle())
.applyClickHandlers(node: node)
}

Expand Down
23 changes: 23 additions & 0 deletions resources/ios/NativeUIListRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ struct NativeUIListRenderer: View {
}
}
.modifier(GroupedOrPlainListStyle(grouped: grouped))
.modifier(ListBackgroundModifier(node: node))
.scrollDismissesKeyboard(.interactively)
.refreshable {
if onRefreshCb != 0 {
Expand Down Expand Up @@ -207,3 +208,25 @@ private struct GroupedOrPlainListStyle: ViewModifier {
}
}
}

/// SwiftUI's List paints the system (grouped) background and ignores the
/// node's own background style, so a themed screen (`bg-theme-background`)
/// renders on the stock gray instead of the app's palette. When the node
/// declares a background, hide the system scroll background and paint the
/// node's color — matching how every other container element behaves.
private struct ListBackgroundModifier: ViewModifier {
let node: NativeUINode
@Environment(\.colorScheme) private var colorScheme

func body(content: Content) -> some View {
let darkBg = colorScheme == .dark ? node.props.getColor("dark_bg_color", default: 0) : 0
let argb = darkBg != 0 ? darkBg : (node.style?.bgColor ?? 0)
if argb != 0 {
content
.scrollContentBackground(.hidden)
.background(Color(argb: argb))
} else {
content
}
}
}
Loading