feat(iOS, Stack v5): Refactor Stack Header implementation and handle selective updates#4248
Open
kmichalikk wants to merge 6 commits into
Open
feat(iOS, Stack v5): Refactor Stack Header implementation and handle selective updates#4248kmichalikk wants to merge 6 commits into
kmichalikk wants to merge 6 commits into
Conversation
kmichalikk
commented
Jul 2, 2026
| std::shared_ptr<const react::RNSStackHeaderConfigShadowNode::ConcreteState> _state; | ||
| RNSStackHeaderConfigShadowStateProxy *_Nonnull _shadowStateProxy; | ||
| RNSStackHeaderConfigEventEmitter *_Nonnull _reactEventEmitter; | ||
| NSMutableArray<id> *_children; |
Contributor
Author
There was a problem hiding this comment.
the protocol defines because I don't want to leak react views here & only need to handle 2 data providing protocols for items and spacers
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the iOS (gamma / Stack v5) header implementation to decouple native UIKit updates from React component views, and introduces selective updates so only the affected header item (or only its menu) is rebuilt.
Changes:
- Replaces the previous “build
RNSStackHeaderDatathen apply” flow with a coordinator that reads config + children directly viaRNSStackHeaderConfigDataProviding. - Adds selective update entry points (
rebuildItemWithId,reapplyMenuForItemWithId) and a menu tracker registry to preserve menu toggle state across interactions. - Adds a new Single Feature Test scenario for visually validating selective updates on iOS.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ios/gamma/stack/screen/RNSStackScreenHeaderCoordinator.mm | New coordinator-driven rebuild + selective item/menu update logic; new menu tracker registry integration. |
| ios/gamma/stack/screen/RNSStackScreenHeaderCoordinator.h | Exposes coordinator API and provider/delegate wiring (config, frame changes, events). |
| ios/gamma/stack/screen/RNSStackScreenComponentView.h | Removes dependency on RNSStackHeaderData. |
| ios/gamma/stack/screen/RNSStackNavigationItemCoordinator.mm | Deleted (logic moved into header coordinator). |
| ios/gamma/stack/screen/RNSStackNavigationItemCoordinator.h | Deleted (logic moved into header coordinator). |
| ios/gamma/stack/host/RNSStackNavigationBarCoordinator.mm | Simplifies API to setHidden:animated:. |
| ios/gamma/stack/host/RNSStackNavigationBarCoordinator.h | Header update for the simplified navigation bar API. |
| ios/gamma/stack/header/RNSStackHeaderMenuTrackerRegistry.mm | New registry storing per-item toggle state trackers. |
| ios/gamma/stack/header/RNSStackHeaderMenuTrackerRegistry.h | Header for the new tracker registry. |
| ios/gamma/stack/header/RNSStackHeaderMenuCoordinator.mm | Adds menuToggleCallback so callers can reapply menus after toggle interactions. |
| ios/gamma/stack/header/RNSStackHeaderMenuCoordinator.h | Documents and exposes the new menuToggleCallback API. |
| ios/gamma/stack/header/RNSStackHeaderItemSpacerComponentView.mm | Updates invalidation callback name for spacer changes. |
| ios/gamma/stack/header/RNSStackHeaderItemInvalidationDelegate.h | Splits invalidation into item rebuild vs menu-only update vs spacer rebuild. |
| ios/gamma/stack/header/RNSStackHeaderItemDataProviding.h | Removes menu toggle tracker from the item-providing protocol (now coordinator-managed). |
| ios/gamma/stack/header/RNSStackHeaderItemComponentView.mm | Emits selective invalidations (rebuild item vs menu-only change). |
| ios/gamma/stack/header/RNSStackHeaderItemComponentView.h | Adds RNSViewFrameChangeDelegate conformance; updates exposed surface. |
| ios/gamma/stack/header/RNSStackHeaderData.mm | Deleted (no longer used). |
| ios/gamma/stack/header/RNSStackHeaderData.h | Deleted (no longer used). |
| ios/gamma/stack/header/RNSStackHeaderContentFactory.mm | Stops applying menus inside the factory; returns base bar button item only. |
| ios/gamma/stack/header/RNSStackHeaderContentFactory.h | Updates docs to reflect menu application moving out of the factory. |
| ios/gamma/stack/header/RNSStackHeaderConfigDataProviding.h | New protocol for exposing config + children to the coordinator. |
| ios/gamma/stack/header/RNSStackHeaderConfigComponentView.mm | Wires provider/delegates into coordinator; routes invalidations to selective coordinator APIs. |
| ios/gamma/stack/header/RNSStackHeaderConfigComponentView.h | Declares protocol conformances and exposes config properties + children. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-header-selective-updates-ios/scenario.md | New manual test scenario steps for selective updates validation. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-header-selective-updates-ios/scenario-description.ts | Scenario metadata for the new SFT. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-header-selective-updates-ios/index.tsx | New SFT implementation exercising selective updates and menu behaviors. |
| apps/src/tests/single-feature-tests/stack-v5/index.ts | Registers the new SFT in the stack-v5 scenario list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+45
to
+49
| [_leadingBarButtonItems removeAllObjects]; | ||
| [_trailingBarButtonItems removeAllObjects]; | ||
| [_barButtonItemsByItemId removeAllObjects]; | ||
| [_trackerRegistry clear]; | ||
|
|
Contributor
Author
There was a problem hiding this comment.
This is so iOS implementation works the same as android implementation
selective updates
42d3af0 to
c7b33f7
Compare
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.
Closes https://github.com/software-mansion/react-native-screens-labs/issues/1567
Description
This PR decouples React component views from native UIKit logic and introduces selective item updates so only the changed item rebuilds.
Changes
RNSStackHeaderDatadata class, now props are read directly from ComponentView via protocolRNSStackHeaderItemCoordinatorintoRNSStackHeaderCoordinatorand removed the classitemIdBefore & after - visual documentation
no-selective-updates.mov
selective-updates.mov
Test plan
Use
test-stack-header-selective-updates-ios.Checklist