feat: Initial code for menu in header items#4138
Open
kmichalikk wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial (experimental) nested header-menu configuration for the gamma iOS stack header items, wiring a new menu prop from JS types through Fabric props into native iOS menu construction, and adds a Single Feature Test scenario to exercise basic nested menu rendering.
Changes:
- Added a
menuprop to gamma stack header inline items (including Fabric native props) plus new TypeScript menu shape types. - Implemented iOS-side mapping from JS dictionaries into native menu data objects and a coordinator that builds
UIMenu/UIActiontrees. - Added an iOS-only SFT scenario (
test-stack-header-menu-ios) and registered it in the stack-v5 scenario index.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/fabric/gamma/stack/StackHeaderItemIOSNativeComponent.ts | Adds menu prop to Fabric native component props (UnsafeMixed). |
| src/components/gamma/stack/header/StackHeaderConfig.ios.types.ts | Extends inline header item types to accept an optional menu. |
| src/components/gamma/stack/header/ios/StackHeaderMenu.ios.types.ts | New TS types describing nested menu structures. |
| src/components/gamma/stack/header/ios/StackHeaderItem.ios.types.ts | Extends stack header item props with optional menu. |
| ios/gamma/stack/header/RNSStackHeaderMenuMapper.h | Declares native mapper that parses JS dictionaries into menu data. |
| ios/gamma/stack/header/RNSStackHeaderMenuMapper.mm | Implements parsing/validation of menu dictionaries into native data objects. |
| ios/gamma/stack/header/RNSStackHeaderMenuData.h | Defines native menu/menuItem data models and protocol for menu elements. |
| ios/gamma/stack/header/RNSStackHeaderMenuData.mm | Implements native menu/menuItem data model initializers. |
| ios/gamma/stack/header/RNSStackHeaderMenuCoordinator.h | Declares coordinator that applies native menus to bar button items. |
| ios/gamma/stack/header/RNSStackHeaderMenuCoordinator.mm | Builds UIMenu/UIAction trees and applies them to UIBarButtonItem. |
| ios/gamma/stack/header/RNSStackHeaderItemDataProviding.h | Extends header item data protocol with a menu property. |
| ios/gamma/stack/header/RNSStackHeaderItemComponentView.h | Exposes menu property on the component view implementing the protocol. |
| ios/gamma/stack/header/RNSStackHeaderItemComponentView.mm | Converts Fabric menu prop to native menu data and triggers invalidation. |
| ios/gamma/stack/header/RNSStackHeaderContentFactory.mm | Applies a parsed menu to the produced UIBarButtonItem. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-header-menu-ios/scenario.md | Adds manual test steps for nested header menu behavior on iOS. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-header-menu-ios/scenario-description.ts | Registers scenario metadata for the new SFT. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-header-menu-ios/index.tsx | Adds SFT implementation exercising nested menus and dynamic item counts. |
| apps/src/tests/single-feature-tests/stack-v5/index.ts | Registers the new iOS header-menu SFT in the stack-v5 suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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/1178
Description
This PR adds some initial configuration for displaying nested header menus.
Changes
menuprop forInlineHeaderItemsmenucan be given type"menu" | "menuItem", atitleand achildrenfor submenusBefore & after - visual documentation
Test plan
Added SFT
test-stack-header-menu-ios. It includes only basic features and will be extended in the future.Checklist