diff --git a/resources/ios/NativeUIListItemRenderer.swift b/resources/ios/NativeUIListItemRenderer.swift index 8ff3a55..b9f7ec2 100644 --- a/resources/ios/NativeUIListItemRenderer.swift +++ b/resources/ios/NativeUIListItemRenderer.swift @@ -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) } diff --git a/resources/ios/NativeUIListRenderer.swift b/resources/ios/NativeUIListRenderer.swift index 9e7c13b..fc1fa66 100644 --- a/resources/ios/NativeUIListRenderer.swift +++ b/resources/ios/NativeUIListRenderer.swift @@ -85,6 +85,7 @@ struct NativeUIListRenderer: View { } } .modifier(GroupedOrPlainListStyle(grouped: grouped)) + .modifier(ListBackgroundModifier(node: node)) .scrollDismissesKeyboard(.interactively) .refreshable { if onRefreshCb != 0 { @@ -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 + } + } +}