Skip to content

Commit 57dcfdc

Browse files
authored
Inbox Conversation Screen Lacks Back Navigation Control On iPad (iOS 26) (#8277)
* possible fix * update of test and minor gap
1 parent aa4f9a3 commit 57dcfdc

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

ios/TopBarPresenter.mm

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,21 @@ - (void)setBackButtonOptions:(RNNBackButtonOptions *)backButtonOptions {
160160
NSNumber *fontSize = [backButtonOptions.fontSize withDefault:nil];
161161

162162
UIViewController *previousViewControllerInStack = self.previousViewControllerInStack;
163-
UIBarButtonItem *backItem = [[RNNUIBarBackButtonItem alloc] initWithOptions:backButtonOptions];
164163
UINavigationItem *previousNavigationItem = previousViewControllerInStack.navigationItem;
165164

165+
BOOL hasCustomization = icon || color || title || fontFamily || fontSize ||
166+
backButtonOptions.displayMode.hasValue ||
167+
backButtonOptions.sfSymbol.hasValue ||
168+
backButtonOptions.iconBackground.hasValue ||
169+
backButtonOptions.enableMenu.hasValue ||
170+
![backButtonOptions.showTitle withDefault:YES];
171+
172+
if (!hasCustomization) {
173+
return;
174+
}
175+
176+
UIBarButtonItem *backItem = [[RNNUIBarBackButtonItem alloc] initWithOptions:backButtonOptions];
177+
166178
if (@available(iOS 13.0, *)) {
167179
UIImage *sfSymbol = [UIImage systemImageNamed:[backButtonOptions.sfSymbol withDefault:nil]];
168180
if (backButtonOptions.sfSymbol.hasValue) {
@@ -195,7 +207,9 @@ - (void)setBackButtonOptions:(RNNBackButtonOptions *)backButtonOptions {
195207
cornerRadius:cornerRadius];
196208
}
197209

198-
[self setBackIndicatorImage:icon withColor:color];
210+
if (icon) {
211+
[self setBackIndicatorImage:icon withColor:color];
212+
}
199213

200214
title = title ? title : (previousNavigationItem.title ? previousNavigationItem.title : @"");
201215

playground/ios/NavigationTests/RNNStackPresenterTest.mm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ - (void)testApplyOptions_shouldSetBackButtonOnBoundViewController_withHideTitle
7373

7474
- (void)testApplyOptions_shouldSetBackButtonOnBoundViewController_withDefaultValues {
7575
[self.uut applyOptions:self.options];
76-
XCTAssertTrue(
77-
[self.boundViewController.viewControllers.firstObject.navigationItem.backBarButtonItem.title
78-
isEqualToString:@""]);
76+
XCTAssertNil(
77+
self.boundViewController.viewControllers.firstObject.navigationItem.backBarButtonItem);
7978
}
8079

8180
- (void)testSetBackButtonIcon_withColor_shouldSetColor {

0 commit comments

Comments
 (0)