Skip to content

Commit f67b64c

Browse files
committed
Hide the back button title using display mode
1 parent 91b6351 commit f67b64c

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,9 @@ + (void)updateViewController:(UIViewController *)vc
631631

632632
auto shouldUseCustomBackBarButtonItem = !isBackTitleBlank || config.disableBackButtonMenu;
633633

634-
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_14_0) && \
635-
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
636-
if (@available(iOS 14.0, *)) {
637-
prevItem.backButtonDisplayMode = config.backButtonDisplayMode;
638-
}
639-
#endif
634+
// This has any effect only in case the `backBarButtonItem` is not set.
635+
// We apply it before we configure the back item, because it might get overriden.
636+
prevItem.backButtonDisplayMode = config.backButtonDisplayMode;
640637

641638
if (config.isBackTitleVisible) {
642639
if ((config.backTitleFontFamily &&
@@ -666,11 +663,9 @@ + (void)updateViewController:(UIViewController *)vc
666663
// back button title should be not visible next to back button,
667664
// but it should still appear in back menu (if one is enabled)
668665

669-
// When backBarButtonItem's title is null, back menu will use value
670-
// of backButtonTitle
671-
[backBarButtonItem setTitle:nil];
672-
shouldUseCustomBackBarButtonItem = YES;
673666
prevItem.backButtonTitle = resolvedBackTitle;
667+
prevItem.backButtonDisplayMode = UINavigationItemBackButtonDisplayModeMinimal;
668+
shouldUseCustomBackBarButtonItem = NO;
674669
}
675670

676671
// Prevent unnecessary assignment of backBarButtonItem if it is not customized,

0 commit comments

Comments
 (0)