skiptools / skiptools/skip-ui

NavigationStack in sheet - extra top padding

Open
#388 7 comments 4 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 a NavigationStack is embedded in a sheet, it adds extra padding above the navigation bar and title/toolbar buttons. It almost appears that it is trying to add safe area insets to the top of the NavigationStack which isn't needed in a sheet.

The below screenshot was taken with a Pixel 10.

Android iOS
Image Image
NavigationStack {
    VStack {
        Text("Root View")
        Button("Present") {
            sheetPresented = true
        }
    }
    .navigationTitle(Text("Root"))
    .navigationBarTitleDisplayMode(.inline)
    .sheet(isPresented: $sheetPresented) {
        NavigationStack {
            VStack {
                Text("Sheet View")
            }
            .navigationTitle(Text("Sheet"))
            .navigationBarTitleDisplayMode(.inline)
            .toolbar {
                ToolbarItem(placement: .topBarTrailing) {
                    Button("Close", systemImage: "xmark") {
                        sheetPresented = false
                    }
                }
            }
        }
    }
}

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

The issue provides a reproducible SwiftUI NavigationStack embedded in a sheet; start by running that sample on Android and iOS and tracing the NavigationStack and sheet layout handling. Done means the sheet's navigation bar, title, and toolbar buttons no longer receive extra top padding while the root view remains unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.