Repository navigation
fix(ios): safe area layout when page view is offset in its superview - #11517
Draft
edusperoni wants to merge 1 commit into
Draft
edusperoni wants to merge 1 commit into
edusperoni wants to merge 1 commit into
Conversation
Page.onLayout received the native frame in superview coordinates but laid out its content as if it started at the origin, making the content taller than the page by the frame offset. IOSHelper.getAvailableSpaceFromParent compared the controller view's frame (superview coordinates) with safe area and in-window positions in the controller view's own coordinates, so iosOverflowSafeArea views never expanded to the bottom edge. This shows up when the page view does not start at (0,0), e.g. with edgesForExtendedLayout = UIRectEdge.Bottom under a visible navigation bar.
|
View your CI Pipeline Execution ↗ for commit 6cdad60
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
This was referenced Oct 22, 2026
modos189
added a commit
to IITC-CE/IITC-Prime
that referenced
this pull request
Oct 22, 2026
Backports NativeScript/NativeScript#11517: for a Page, nativeViewProtected is the controller's view, which a transition animates by transform, so its frame reads as an off-screen rect while the safe-area values beside it are in bounds space.
This branch has not been deployed
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 Checklist
What is the current behavior?
When a page's controller view does not start at (0,0) in its superview, safe-area layout breaks on iOS. The common trigger is
page.ios.edgesForExtendedLayout = UIRectEdge.Bottomwith a visible navigation bar: UIKit places the controller view below the bar (y ≈ 152pt with a large title).Two places mix the controller view's frame (superview coordinates) with values in the view's own coordinates:
Page.onLayoutgets the native frame fromView.layout()and lays out its content tobottom - insets.bottom/right - insets.right. The content ends up taller than the page by the frame offset.IOSHelper.getAvailableSpaceFromParentreturnsfullscreen = viewControllerView.frame.expandBeyondSafeAreacompares it withsafeAreaLayoutGuide.layoutFrameand the in-window position, which are both relative to the controller view, so the bottom check (inWindow.bottom >= safeArea.bottom + fullscreen.top) never passes.What you see:
iosOverflowSafeArea = trueat the bottom of the page stops at the safe-area bottom instead of reaching the screen edge (under the home indicator).UIToolbarat the bottom shows a gap below it. UIKit only extends a bar's background into the bottom safe area when the bar touches its superview's safe-area bottom, and the page content is the wrong size and position for that.edgesForExtendedLayout = Bottominside a TabView gets its content pushed down by the offset, so the bottom rows end up under the tab bar.What is the new behavior?
Page.onLayoutsubtracts the origin:childRight = right - left - insets.right,childBottom = bottom - top - insets.bottom.getAvailableSpaceFromParentusesviewControllerView.bounds, sofullscreen,safeAreaandinWindowshare one coordinate space.When the frame origin is (0,0), which is the default
edgesForExtendedLayout = Allcase, both changes do nothing.Tests
apps/automatedtestSAFEAREALAYOUT.test_overflow_reaches_bottom_when_page_view_is_offset: a page with a visible ActionBar andedgesForExtendedLayout = Bottom, holding aGridLayoutwith rows*, 44and aniosOverflowSafeAreaLabel in the bottom row. It checks that the page view is offset, then asserts that the page, grid and label all reach the screen bottom. On the iOS 26.3 simulator (iPhone 17 Pro) it fails without this change (GridLayout.bottom - actual:2970; expected: 2622) and passes with it.apps/automatediOS suite on the same simulator: 1828 OK, 0 failed.UIToolbarat the bottom. Layouts with default edges are unchanged.Follow-ups (not in this PR)
expandBeyondSafeAreastill addsfullscreenPosition.left/fullscreenPosition.topin the right/bottom checks. Both are now always 0 on the controller-view and scroll-view paths, so the terms could be dropped.IOSHelper.layoutViewlays out the owner withcontroller.view.framewhen the controller has child view controllers. This has no effect today becauseView.layout()reads the native frame again, butboundswould be consistent with this change.edgesForExtendedLayout = Bottominside a TabView now lays out correctly at the bottom, but still shows an empty band of roughly 60pt under the navigation bar. It comes from the page reporting a top safe-area inset, set by theadditionalSafeAreaInsetslogic inUILayoutViewController.viewDidLayoutSubviews. This was already the case before this change and needs separate investigation.