Browse Source

add hideBackButtonTitle in order to remove the back button title in the appStyle (#1837)

Ran Greenberg 7 years ago
parent
commit
52a093e17f
2 changed files with 7 additions and 0 deletions
  1. 1
    0
      docs/top-level-api.md
  2. 6
    0
      ios/RCCNavigationController.m

+ 1
- 0
docs/top-level-api.md View File

@@ -60,6 +60,7 @@ Navigation.startTabBasedApp({
60 60
     bottomTabBadgeTextColor: 'red', // Optional, change badge text color. Android only
61 61
     bottomTabBadgeBackgroundColor: 'green', // Optional, change badge background color. Android only
62 62
     backButtonImage: require('./pathToImage.png') // Change the back button default arrow image with provided image. iOS only
63
+    hideBackButtonTitle: true/false // Hide back button title. Default is false. If `backButtonTitle` provided so it will take into account and the `backButtonTitle` value will show. iOS only
63 64
   },
64 65
   drawer: { // optional, add this if you want a side menu drawer in your app
65 66
     left: { // optional, define if you want a drawer from the left

+ 6
- 0
ios/RCCNavigationController.m View File

@@ -122,6 +122,12 @@ NSString const *CALLBACK_ASSOCIATED_ID = @"RCCNavigationController.CALLBACK_ASSO
122 122
                      style:navigatorStyle];
123 123
     
124 124
     NSString *backButtonTitle = actionParams[@"backButtonTitle"];
125
+    if (!backButtonTitle) {
126
+      NSNumber *hideBackButtonTitle = [[RCCManager sharedInstance] getAppStyle][@"hideBackButtonTitle"];
127
+      BOOL hideBackButtonTitleBool = hideBackButtonTitle ? [hideBackButtonTitle boolValue] : NO;
128
+      backButtonTitle = hideBackButtonTitleBool ? @"" : backButtonTitle;
129
+    }
130
+    
125 131
     if (backButtonTitle)
126 132
     {
127 133
       UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:backButtonTitle