Skip to content

fix(ios): strip phantom top inset when presented as a page sheet (#42)#43

Merged
mibrahimdev merged 3 commits into
developfrom
fix/42-ios-sheet-top-inset
Jul 3, 2026
Merged

fix(ios): strip phantom top inset when presented as a page sheet (#42)#43
mibrahimdev merged 3 commits into
developfrom
fix/42-ios-sheet-top-inset

Conversation

@mibrahimdev

Copy link
Copy Markdown
Owner

Fixes #42.

Root cause

A page sheet already sits below the status bar, but CMP 1.11 sources WindowInsets.safeDrawing from the UIWindow (62pt on iPhone 16 Pro), not the sheet's own view (0) — so the sheet paid the top inset twice, showing as a ~60pt dead gray band above the header.

Fix (entry-point-scoped, no public API change)

  • commonMain: internal LocalStripTopInset CompositionLocal + pure sharinganContentInsets() helper; the Scaffold drops the top side of safeDrawing when the local is set.
  • iosMain: presentSharingan() now presents an internal sharinganSheetViewController() that provides the local as true. The public SharinganViewController() factory is byte-for-byte behavior-identical (strip = false), so full-screen/embedded/pushed hosts keep their top inset.
  • Android untouched.

Verification

  • New commonTest pins the inset math (ScreenInsetsTest, written RED-first).
  • :sharingan:testDebugUnitTest, :sharingan:apiCheck, checkApiParity all green locally — internal declarations stay off the checked API surface.
  • Simulator (iPhone 16 Pro, iOS 18.0): presentSharingan() sheet shows the header flush at the sheet top (band gone); a directly-created SharinganViewController presented full-screen still gets its status-bar top inset.

Upstream context: known class of CMP inset bug (CMP-7588, JetBrains/compose-multiplatform#4121/#4944); no config flag exists in CMP 1.11, hence the library-side scoped exclusion.

🤖 Generated with Claude Code

mibrahimdev and others added 3 commits July 3, 2026 17:00
A page sheet already sits below the status bar, but CMP 1.11 sources
safeDrawing from the UIWindow, so the sheet paid the status-bar inset
twice — a ~62pt dead band above the header (iPhone 16 Pro).

presentSharingan() now presents an internal sheet variant that provides
LocalStripTopInset, and the Scaffold drops the top side of safeDrawing
when it is set. The public SharinganViewController() factory is
unchanged, so full-screen/embedded hosts keep their top inset. No
public API changes (apiCheck + checkApiParity green).

Fixes #42

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Kotlin/Native forbids ',' in identifiers; commonTest also compiles for
the iOS targets, so the #42 inset test broke compileTestKotlinIosArm64.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review polish for #42: the raw-VC KDoc now warns that a self-presented
page sheet shows the phantom top gap and points at presentSharingan();
the inset test also pins the right side surviving the strip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mibrahimdev

Copy link
Copy Markdown
Owner Author

Verification evidence (issue #42)

All iOS captures via xcrun simctl io screenshot (iPhone 16 Pro, iOS 18); Android via adb screencap. Full-size images on the evidence/pr-43 orphan branch.

Before (0.1.1, sheet) After (this PR, sheet)
before after

The fix: ~62pt gray band above the header (left) is gone (right) — header flush at the sheet top via presentSharingan().

Check Evidence
Sheet swipe-down dismissal still works swipe
Full-screen presentation retains top inset (no regression for embedded hosts) fullscreen
Android layout unchanged (status-bar inset respected) android
Strip is entry-point-scoped: raw public VC self-presented as a sheet still shows the band (documented deferred case — KDoc now steers sheet hosts to presentSharingan()) scoping

Deferred-case reference: deferred

Verified by two independent agents (behavioral pass + evidence-backed diff review); CI green ×5 including the Android emulator locale-regression suite.

🤖 Generated with Claude Code

@mibrahimdev mibrahimdev merged commit cc0a89e into develop Jul 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: ~60pt dead gray band above the header when presented as a page sheet (double top inset)

1 participant