Skip to content

fix(ios): improve TabView handling around more navigation controller#11225

Merged
NathanWalker merged 2 commits into
NativeScript:mainfrom
owenthcarey:fix/ios-tabview-more-nav-controller
May 21, 2026
Merged

fix(ios): improve TabView handling around more navigation controller#11225
NathanWalker merged 2 commits into
NativeScript:mainfrom
owenthcarey:fix/ios-tabview-more-nav-controller

Conversation

@owenthcarey
Copy link
Copy Markdown
Contributor

  • Fixes cases when iOS auto rolls up extended TabView items which could result in white screens on the Page/Frame due to timing around delegate events.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 21, 2026

View your CI Pipeline Execution ↗ for commit 3b803c9

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 46s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 3s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-21 22:15:40 UTC

@NathanWalker
Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

iOS tab view delegate handling is refactored to expose the More navigation controller delegate as a public property wired through TabView initialization and disposal. After iOS clears this delegate on tab selection, the tab bar callback re-asserts it. Navigation callbacks now force layout updates to ensure late-attached pages render after push animations.

Changes

iOS tab view delegate and layout handling

Layer / File(s) Summary
More navigation delegate property and lifecycle wiring
packages/core/ui/tab-view/index.ios.ts
TabView exposes public moreNavigationControllerDelegate property initialized in initNativeView, cleared in disposeNativeView, and reassigned in setViewControllers to maintain delegate consistency across iOS lifecycle events.
Delegate re-assertion on tab selection
packages/core/ui/tab-view/index.ios.ts
tabBarControllerDidSelectViewController checks and re-asserts moreNavigationController.delegate after iOS clears it during tab selection to restore navigation callback routing.
Layout enforcement on page navigation
packages/core/ui/tab-view/index.ios.ts
navigationControllerDidShowViewControllerAnimated forces layout update (setNeedsLayout + layoutIfNeeded) on the shown view controller to ensure late-attached pages become visible after push animation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing iOS TabView handling around the more navigation controller, which directly aligns with the core modification of re-asserting the moreNavigationController delegate.
Description check ✅ Passed The description is related to the changeset, explaining the practical issue being fixed: white screens caused by timing issues with delegate events when iOS auto-rolls extended TabView items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
packages/core/ui/tab-view/index.ios.ts (2)

137-144: 💤 Low value

Consider adding a defensive check for moreNavigationControllerDelegate.

The code re-asserts the delegate to ensure callbacks reach the TabView, but doesn't verify that owner.moreNavigationControllerDelegate is non-null before assignment. While unlikely during an active tab selection callback, adding a check would align with the stated intent of "re-asserting" the delegate rather than potentially clearing it.

🛡️ Proposed defensive check
 // iOS lazily initializes moreNavigationController (e.g. on first access of
 // topViewController, or on first tap of the More tab) and can clear the
 // delegate we set in setViewControllers. Re-assert it whenever any tab is
 // selected so moreNav push/pop callbacks for tabs >= 5 still reach us.
 const moreNav = tabBarController.moreNavigationController;
-if (moreNav && moreNav.delegate !== owner.moreNavigationControllerDelegate) {
+if (moreNav && owner.moreNavigationControllerDelegate && moreNav.delegate !== owner.moreNavigationControllerDelegate) {
   moreNav.delegate = owner.moreNavigationControllerDelegate;
 }

606-606: ⚡ Quick win

Add null check on moreNavigationController for consistency.

Line 142 guards access to moreNavigationController with a null check, but this line doesn't. While accessing properties on nil in Objective-C is safe (no-op), adding a consistent check improves clarity and defensive programming, especially since moreNavigationController is nil when there are fewer than 5 tabs.

♻️ Proposed consistency fix
 // When we set this._ios.viewControllers, someone is clearing the moreNavigationController.delegate, so we have to reassign it each time here.
-this._ios.moreNavigationController.delegate = this.moreNavigationControllerDelegate;
+if (this._ios.moreNavigationController) {
+  this._ios.moreNavigationController.delegate = this.moreNavigationControllerDelegate;
+}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 43fd6597-98a1-456b-98af-7fb25bcc3f08

📥 Commits

Reviewing files that changed from the base of the PR and between 4070d91 and 3b803c9.

📒 Files selected for processing (1)
  • packages/core/ui/tab-view/index.ios.ts

Comment thread packages/core/ui/tab-view/index.ios.ts Outdated
Comment thread packages/core/ui/tab-view/index.ios.ts Outdated
Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>
@NathanWalker NathanWalker merged commit 914e4bc into NativeScript:main May 21, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants