Skip to content

fix(ios): preserve lazy controller loading during layout invalidation - #11587

Merged
NathanWalker merged 4 commits into
NativeScript:mainfrom
rafaelaugustos:fix/ios-request-layout-lazy-controller
Nov 12, 2026
Merged

NathanWalker merged 4 commits into
NativeScript:mainfrom
rafaelaugustos:fix/ios-request-layout-lazy-controller

Conversation

@rafaelaugustos

@rafaelaugustos rafaelaugustos commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

When a Frame is attached below a direction-bearing root before Application.run(), inherited CSS direction calls requestLayout(). Reading viewController.view there eagerly loads the navigation controller before UIApplicationMain; on iOS 18.6 the resulting app terminates on TextField focus with the UIKit gesture-graph targetNode assertion.

What is the new behavior?

Use viewIfLoaded when invalidating the controller view. Layout flags, ancestor propagation and invalidation of already loaded native views remain intact. Android already invalidates only an existing native view; no public API or declaration changes are needed.

Fixes #11586.

Validation

  • New unloaded-controller regression fails on the original implementation; all 7 requestLayout tests pass with the fix.
  • Full npx nx run core:test --skip-nx-cache: 568 passed, 1 skipped, 44 files passed.
  • Core 9.1.3 fixture with this exact block change: prebuilt inherited LTR and explicit pre-startup requestLayout() pass keyboard editing and cancelled/committed native Back on iPhone/iPad simulators running 18.6.
  • NativeScript-Vue 3.1.2 only: direction/no-direction controls pass on iOS 18.6.
  • Published vue-router-ns rc.3: inherited LTR and tabs controls pass on iOS 18.6 and 26.0.
  • Explicitly forcing controller.view before startup still crashes with the patch: the negative control isolates early view loading, without CSS direction.
  • Added two real-native assertions in apps/automated; that complete app suite was not run. Interaction coverage comes from the external Core/Vue/router fixture and XCTest runner linked below.
  • Physical iPhone unavailable during this pass; dynamic RTL and arbitrary navigation hosts were not certified.

Reproduction, reversible pinned-dependency patch, XCTest sources and results: rafaelaugustos/vue-router-ns#160 (companion reproduction and evidence PR).

Video

Actual iOS 18.6 simulator recording using the published router with only this Core correction: inherited LTR, tabs control, tabs with inherited LTR. Each flow types into a TextField, reverses native Back while preserving the draft, then completes Back.

core-lazy-controller-navigation.mp4

@nx-cloud

nx-cloud Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 3858d6b

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

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-12 23:32:57 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11587
npm i https://pkg.pr.new/@nativescript/vite@11587
npm i https://pkg.pr.new/@nativescript/webpack@11587

commit: 3858d6b

@NathanWalker
NathanWalker merged commit 40c1682 into NativeScript:main Nov 12, 2026
7 checks passed
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.

iOS: prebuilt Frame tree with inherited CSS direction triggers UIKit targetNode assertion

3 participants