Skip to content

Handle a top tab bar on iPad - #304

Open
AnneKlapwijk wants to merge 1 commit into
mainfrom
chore/ipad-top-tab-bar
Open

AnneKlapwijk wants to merge 1 commit into
mainfrom
chore/ipad-top-tab-bar

Conversation

@AnneKlapwijk

Copy link
Copy Markdown
Member

Brings the template in line with the iOS navigation in GoingsOn.CMP, so other projects can pick it up from here.

Compared

I compared the navigation code of GoingsOn.CMP (main) with the template (main) after #256, #262 and #275.

Already the same in both, no change needed:

  • Predictive back duration of 250 ms (faster finish after releasing a back swipe)
  • Navigation dim (scrim) of 10% alpha, light and dark
  • No slide when a predictive back goes between two tabs
  • Blocking back while a transition runs

Only in GoingsOn, ported here:

  • iPad top tab bar: on iPad the native tab bar can sit at the top. It used to be treated as a bottom bar, so AppNavigationBarSpacer could take almost the full screen height. A top bar now reports 0 bottom height and is added to the top additionalSafeAreaInsets of the Compose view controller. Came from the Copilot review on Q42/GoingsOn.CMP#47.
  • Clearer comment on why keepContentAboveTabs re-attaches the Compose view controller after setTabs.

Left out on purpose:

  • Filled icons for the selected tab: GoingsOn design, not needed in the template.
  • Separate TabBarControllerDelegate: the template is newer here (NativeTabBarController is its own delegate since 116f60a).
  • Typing the back stack as Destination, TabClickEvents and deep links: outside the scope of navigation transitions.

Tested

  • :core:ui and :shared compile for iOS simulator.
  • Not run on an iPad yet (also only compile-checked in GoingsOn).

🤖 Generated with Claude Code

On iPad the native tab bar can sit at the top: report 0 bottom height and
add it to the Compose safe area instead, so screens lay out below it.
Ported from GoingsOn.CMP, where this came out of the review of Q42/GoingsOn.CMP#47.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnneKlapwijk
AnneKlapwijk requested a review from a team as a code owner November 24, 2026 14:57
Copilot AI balanced review requested due to automatic review settings November 24, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Compile checks cannot verify iPad tab geometry or Compose safe-area propagation during rotation, resizing, and tab visibility changes, so simulator or device validation is needed.

No open issues 🎉

What changed in this PR

Updates the template’s native iOS navigation to handle top-positioned tab bars on iPad, building on the existing bottom and side-bar support.

Changes:

  • Detects top-positioned tab bars and adds their height to the Compose controller’s top safe-area inset.
  • Reports zero bottom tab-bar height for top bars, preventing excessive navigation spacer height.
  • Documents iPad placement and clarifies the existing Compose controller reattachment behavior.
File Description
core/​ui/​src/​iosMain/​kotlin/​nl/​q42/​template/​core/​ui/​compose/​composables/​navigation/​NativeTabBarController.kt Detects bar placement and adjusts top safe-area insets.
core/​ui/​src/​iosMain/​kotlin/​nl/​q42/​template/​core/​ui/​compose/​composables/​navigation/​NativeTabBar.kt Excludes top-positioned bars from bottom spacing.
core/​ui/​src/​commonMain/​kotlin/​nl/​q42/​template/​core/​ui/​compose/​composables/​navigation/​AppNavigationBar.kt Updates documentation for iPad placement and height reporting.

Review effort: Balanced

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.

4 participants