feat(iOS, Split): Nesting Stack v5 in SplitView - #4602
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughChangesThe iOS split container now accepts navigation controllers supplied by nested stack hosts. Stack hosts expose a provider protocol, split columns manage provider takeover and frame observation, and split hosts integrate supplied controllers while preserving existing native-column behavior. Provider-backed Split columns
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This adds support for rendering Stack hosts directly in Split columns while preserving stack navigation ownership and frame updates. No concrete current-head merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant RNSSplitScreenComponentView
participant RNSStackHostComponentView
participant RNSSplitHostController
participant ProvidedView
RNSSplitScreenComponentView->>RNSStackHostComponentView: Set parent placement
RNSSplitScreenComponentView->>ProvidedView: Observe frame
RNSSplitScreenComponentView->>RNSSplitHostController: Request child controller update
RNSSplitHostController->>RNSStackHostComponentView: Flush pending updates
RNSStackHostComponentView-->>RNSSplitHostController: Return navigation controller
ProvidedView-->>RNSSplitScreenComponentView: Report frame change
RNSSplitScreenComponentView->>RNSSplitHostController: Update shadow frame
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
|
assiging @kkafar for reviewing if this is the right direction |
There was a problem hiding this comment.
🟡 Changes recommended
Nested stacks currently regress header hit-testing and navigation-bar visibility.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Enables iOS Split columns to directly host Stack v5 navigation controllers.
Changes:
- Adds a generic navigation-controller provider protocol.
- Integrates Stack hosts as Split column controllers.
- Adds frame reporting for stack-backed columns.
File summaries
| File | Description |
|---|---|
ios/helpers/container/RNSNavigationControllerProviding.h |
Defines the provider contract. |
ios/split/RNSSplitHostController.mm |
Installs provided controllers. |
ios/split/RNSSplitScreenComponentView.h |
Exposes nested-controller state. |
ios/split/RNSSplitScreenComponentView.mm |
Handles provider mounting and frames. |
ios/stack/host/RNSStackHostComponentView.h |
Adopts the provider protocol. |
ios/stack/host/RNSStackHostComponentView.mm |
Exposes and delegates Stack controller placement. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Controller's pending updates must be populated before the SplitView attaches it. | ||
| [provider flushPendingUpdates]; | ||
| return provider.navigationController; |
| /** | ||
| * @brief Gets the children RNSSplitScreenController instances. | ||
| * @brief Gets the children UINavigationControllers instances. | ||
| * | ||
| * Accesses Split controllers associated with presented columns. It asserts that each view controller is a navigation | ||
| * controller and its topViewController is of type RNSSplitScreenController. | ||
| * | ||
| * @return An array of RNSSplitScreenController corresponding to current split view columns. | ||
| * @return An array of UINavigationController corresponding to current split view columns. |
Description
POC of hosting Stack v5 directly inside Split columns on iOS. A
Stack.Hostmounted as the only child of aSplit.Columnbecomes the column itself: itsRNSStackNavigationControlleris installed as the column's view controller, the stack screens become the column's view controllers.The stack keeps the exact structure it has standalone.
Stack.Hoststill owns and drives all navigation operations. The only thing that differs is that, for SplitView, the SplitHost is placing that controller in the VC hierarchy. The whole communication goes through a generic protocol, so Split knows nothing about Stack.Consequence worth stating explicitly: in this mode neither the
Split.Columnview nor theStack.Hostview is part of the UIKit view hierarchy.This is an initial PR proposing only the attachment mechanism and the resulting hierarchy. Follow-ups are listed below and are deliberately out of scope of this content.
Closes: https://github.com/software-mansion/react-native-screens-labs/issues/694
Changes
RNSNavigationControllerProviding: a component view backed by aUINavigationControllerexposes it, accepts a flag telling it that the parent places the controller and can apply its pending updates on demand.RNSStackHostComponentView: conforms to that protocol. It keeps owning itsRNSStackNavigationController, butdidMoveToWindowcan skip the self-placement while the flag is set.RNSSplitScreenComponentView:mountChildComponentView:detects a child conforming to the protocol, marks the provider as placed by the parent. The column frame for such a column is reported to the ShadowTree via KVO on the provided controller's view frame (the view is loaded at mount so the very first frame set byUISplitViewControlleris observed). This is marked as temporary, to be unified withRNSSplitNavigationControllerFrameObserver.RNSSplitHostController: flushes the provider to execute the external controller's updates before the split attaches it.Out of scope of the POC (known, expected not to work)
RNSSplitScreenControllerin the hierarchy), stack emits these events instead.Stack.Hostchild is not supported yet.RNSSplitNavigationControllerFrameObserver(for plain columns) and the KVO in the column view (stack-backed columns); the further direction is one observer per column owned by the native column controller, with the SplitHost talking to columns only.Before & after - visual documentation
18.mov
26.mov
Test plan
The scenario will be added after discussing the solution. I'd recommend pasting the minimal example into
TestSplitPressablesfor now.Checklist