Browse Source

backButtonTitle support

yogevbd 7 years ago
parent
commit
904f02a8ae
2 changed files with 10 additions and 0 deletions
  1. 1
    0
      lib/ios/RNNTopBarOptions.h
  2. 9
    0
      lib/ios/RNNTopBarOptions.m

+ 1
- 0
lib/ios/RNNTopBarOptions.h View File

@@ -19,6 +19,7 @@
19 19
 @property (nonatomic, strong) NSString* testID;
20 20
 @property (nonatomic, strong) RNNTitleOptions* title;
21 21
 @property (nonatomic, strong) NSNumber* backButtonImage;
22
+@property (nonatomic, strong) NSString* backButtonTitle;
22 23
 
23 24
 @property (nonatomic, strong) NSString* componentName;
24 25
 @property (nonatomic, strong) NSString* backgroundComponentName;

+ 9
- 0
lib/ios/RNNTopBarOptions.m View File

@@ -149,6 +149,15 @@ extern const NSInteger BLUR_TOPBAR_TAG;
149 149
 	UIImage *image = self.backButtonImage ? [RCTConvert UIImage:self.backButtonImage] : nil;
150 150
 	[[UINavigationBar appearance] setBackIndicatorImage:image];
151 151
 	[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:image];
152
+	
153
+	if (self.backButtonTitle) {
154
+		UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:self.backButtonTitle
155
+																	 style:UIBarButtonItemStylePlain
156
+																	target:nil
157
+																	action:nil];
158
+		
159
+		viewController.navigationItem.backBarButtonItem = backItem;
160
+	}
152 161
 }
153 162
 
154 163
 -(void)storeOriginalTopBarImages:(UIViewController*)viewController {