Repository navigation
Handle a top tab bar on iPad - #304
Open
AnneKlapwijk wants to merge 1 commit into
Open
AnneKlapwijk wants to merge 1 commit into
AnneKlapwijk wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
🔵 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Only in GoingsOn, ported here:
AppNavigationBarSpacercould take almost the full screen height. A top bar now reports 0 bottom height and is added to the topadditionalSafeAreaInsetsof the Compose view controller. Came from the Copilot review on Q42/GoingsOn.CMP#47.keepContentAboveTabsre-attaches the Compose view controller aftersetTabs.Left out on purpose:
TabBarControllerDelegate: the template is newer here (NativeTabBarControlleris its own delegate since 116f60a).Destination,TabClickEventsand deep links: outside the scope of navigation transitions.Tested
:core:uiand:sharedcompile for iOS simulator.🤖 Generated with Claude Code