Skip to content

Commit

Permalink
Fixes default value for back button when title is empty (#6552)
Browse files Browse the repository at this point in the history
When the current navigation stack presents a new view controller with the topbar included, if the previous view controller didn't had a `{title: {text: string}}` defined, the app crashed. 

This commit fixes this issue which, by default, should render the back button with no text. 

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
  • Loading branch information
mateioprea and guyca authored Sep 9, 2020
1 parent 29c97e0 commit 0c9c996
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ios/TopBarPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ - (void)setBackButtonOptions:(RNNBackButtonOptions *)backButtonOptions {
[self setBackIndicatorImage:icon withColor:color];

if (showTitle) {
backItem.title = title ? title : previousViewControllerInStack.navigationItem.title;
backItem.title = title ? title : (previousViewControllerInStack.navigationItem.title ? previousViewControllerInStack.navigationItem.title : @"");;
} else {
backItem.title = @"";
}
Expand Down

0 comments on commit 0c9c996

Please sign in to comment.