skiptools / skiptools/skip-ui

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

Open
#448 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
330
Forks
76
Avg merge
3h 6m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Sources/SkipUI/SkipUI/Containers/List.swift and trace how the Android renderer applies the listed container and item insets alongside contentMargins and listRowInsets. Reproduce the supplied List example, then verify that edge-to-edge content and controllable row or section insets work without negative padding.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.