Skip to content

List on Android applies hardcoded horizontal/vertical insets that cannot be removed with SwiftUI modifiers #448

@michele-theleftbit

Description

@michele-theleftbit

When rendering a SwiftUI List through SkipUI on Android, the list keeps horizontal and vertical spacing even after removing all app-level padding and setting .contentMargins(0, for: .scrollContent).
This makes it impossible to create an edge-to-edge/custom-card list layout matching SwiftUI expectations without using negative padding.

List {
    Section {
        Text("Row")
            .background(.white)
    } header: {
        Text("Header")
    }
}
.listStyle(.automatic)
.contentMargins(0, for: .scrollContent)
.listRowBackground(Color.clear)
.scrollContentBackground(.hidden)

Expected

contentMargins(0, for: .scrollContent)should allow removing scroll/list content margins, or there should be another public API to remove them.
Row/section insets should be controllable vialistRowInsetsor equivalent.

Actual on Android

The list still has horizontal and vertical spacing.
The only workaround is negative padding or avoidingList.

Source
In Sources/SkipUI/SkipUI/Containers/List.swift, the Android renderer applies hardcoded insets:

if styling.style != .plain {
    modifier = modifier.padding(start: Self.horizontalInset.dp, end: Self.horizontalInset.dp)
}
private static let horizontalInset = 16.0
private static let verticalInset = 16.0
private static let horizontalItemInset = 16.0
private static let verticalItemInset = 8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions