feat(ios): add largeTitleDisplayMode prop to native stack header#3817
feat(ios): add largeTitleDisplayMode prop to native stack header#3817dacoto wants to merge 2 commits intosoftware-mansion:mainfrom
largeTitleDisplayMode prop to native stack header#3817Conversation
…lineLarge support) Agent-Logs-Url: https://github.com/dacoto/react-native-screens/sessions/264e9ecb-adc1-4f67-826a-13446d6a25be Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new iOS-only largeTitleDisplayMode prop to ScreenStackHeaderConfig to expose UINavigationItemLargeTitleDisplayMode (including iOS 17+ inlineLarge) while keeping existing largeTitle behavior as the fallback when the new prop is unset/'none'.
Changes:
- Adds
LargeTitleDisplayModeunion type andlargeTitleDisplayMode?: LargeTitleDisplayModeto the public TS props. - Extends Fabric codegen props with
largeTitleDisplayMode(default'none'). - Adds native enum + conversion/export plumbing and updates header configuration logic to apply the selected display mode (with iOS 17 fallback for
inlineLarge).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types.tsx | Exposes the new largeTitleDisplayMode prop/type to JS/TS consumers. |
| src/fabric/ScreenStackHeaderConfigNativeComponent.ts | Adds Fabric codegen prop with default 'none'. |
| ios/RNSScreenStackHeaderConfig.mm | Applies the new display mode (and keeps legacy largeTitle behavior for 'none'), adds Paper prop export + enum converter. |
| ios/RNSScreenStackHeaderConfig.h | Adds native property and RCTConvert declaration for the new enum. |
| ios/RNSEnums.h | Introduces RNSLargeTitleDisplayMode native enum. |
| ios/RNSConvert.mm | Adds Fabric C++->ObjC enum conversion helper. |
| ios/RNSConvert.h | Declares the new Fabric conversion helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case Never: | ||
| return RNSLargeTitleDisplayModeNever; | ||
| case InlineLarge: | ||
| return RNSLargeTitleDisplayModeInlineLarge; |
There was a problem hiding this comment.
RNSLargeTitleDisplayModeFromCppEquivalent has a non-void switch without a default branch or a fallback return. Even if the enum is currently exhaustive, this is undefined behavior if a new enum value is added (and may trigger compiler warnings / -Werror). Add a default case that logs and returns a safe fallback (e.g. RNSLargeTitleDisplayModeNone).
| return RNSLargeTitleDisplayModeInlineLarge; | |
| return RNSLargeTitleDisplayModeInlineLarge; | |
| default: | |
| RCTLogError(@"RNSLargeTitleDisplayModeFromCppEquivalent: unexpected largeTitleDisplayMode value (%d). Falling back to RNSLargeTitleDisplayModeNone.", | |
| static_cast<int>(largeTitleDisplayMode)); | |
| return RNSLargeTitleDisplayModeNone; |
Description
Exposes iOS's
UINavigationItemLargeTitleDisplayModeto React Native via a newlargeTitleDisplayModeprop onScreenStackHeaderConfig. Previously, only a booleanlargeTitleprop was available, mapping toAlways/Never. This change provides granular control, including support for the iOS 17+inlineLargemode.Changes
LargeTitleDisplayModetype:'none' | 'automatic' | 'always' | 'never' | 'inlineLarge'ScreenStackHeaderConfigProps(src/types.tsx) — new optionallargeTitleDisplayModeprop (iOS only)ScreenStackHeaderConfigNativeComponent.ts) — prop added with default'none'RNSLargeTitleDisplayModeenum (RNSEnums.h) — native enum withNone/Automatic/Always/Never/InlineLargeRNSConvertmethod for Fabric (C++ → ObjC);RCTConvertenum converter +RCT_EXPORT_VIEW_PROPERTYfor PaperupdateViewController:withConfig:animated:—'none'delegates to the existinglargeTitlebool (fully backward-compatible);inlineLargerequires iOS 17+ with fallback toAlwayson older versionsTest plan
largeTitleDisplayModetakes precedence overlargeTitlewhen set to any value other than'none'.Steps to reproduce / verify:
largeTitleDisplayMode="automatic"/"always"/"never"and confirm behavior matchesUINavigationItemLargeTitleDisplayMode.largeTitleDisplayMode="inlineLarge"on iOS 17+ and verify compact inline large title renders correctly.largeTitleDisplayMode="inlineLarge"on iOS < 17 and confirm fallback toAlways.largeTitleDisplayModeunset and confirm existinglargeTitleprop behavior is unchanged.Checklist