feat(iOS): enable sidebarAdaptable on large enough screens - #580
Draft
thiagobrez wants to merge 1 commit into
Draft
feat(iOS): enable sidebarAdaptable on large enough screens#580thiagobrez wants to merge 1 commit into
thiagobrez wants to merge 1 commit into
Conversation
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.
PR Description
Feature.
sidebarAdaptablealready turned the tab bar into a sidebar on iPadOS, macOS, tvOS and visionOS, but on iOS it always fell back to the bottom tab bar. This enables it on iOS too, for screens that are large enough — most notably an unfolded iPhone Duo.iOS 27 shows the iPhone sidebar only when the tab bar controller's horizontal size class is regular, so the change is in two parts:
sidebarAdaptableis set, the tab view appliesdefaultTabBarPlacement(.sidebar)and setssidebar.preferredLayout = .tileon iPhone, so the selected scene is laid out beside the sidebar instead of underneath it. The scene is measured within that content area, so React Native lays out against the visible width.TabViewProvidersetstraitOverrides.horizontalSizeClasson the hosting controller from the actual window size: regular at ≥ 920pt wide with a regular vertical size class, compact otherwise. UIKit then switches between the sidebar and the bottom tab bar on its own as the window resizes.The 920pt floor is deliberate. UIKit collapses the iPhone sidebar below roughly 905pt even in a regular width, and hides the tab bar at the same time, which leaves a blank strip. Forcing compact below the floor keeps the bottom tab bar there. Regular phones never reach that width in portrait, and landscape phones are excluded by their compact vertical size class, so existing apps are unaffected.
Everything is gated behind
#available(iOS 27.0, *)andcompiler(>=6.4), so older runtimes and older Xcode versions are unchanged.How to test?
There is no iPhone Duo simulator yet, so the unfolded display is approximated with Xcode 27's Device Hub Resize Mode:
sidebarAdaptable, such as Four Tabs or Six Tabs. (Three Tabs deliberately does not set it and stays on bottom tabs.)Verified at 402×874, 655×874 and 900×675 (bottom tabs) and at 1000×750 and 1280×874 (sidebar), resizing in both directions.
Screenshots
Notes
sidebarAdaptableon large enough iOS screens.BottomTabBarHeightContextis not updated while the sidebar is showing. Worth a follow-up if screens pad for the bar.🤖 Generated with Claude Code