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

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

149
 	UIImage *image = self.backButtonImage ? [RCTConvert UIImage:self.backButtonImage] : nil;
149
 	UIImage *image = self.backButtonImage ? [RCTConvert UIImage:self.backButtonImage] : nil;
150
 	[[UINavigationBar appearance] setBackIndicatorImage:image];
150
 	[[UINavigationBar appearance] setBackIndicatorImage:image];
151
 	[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:image];
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
 -(void)storeOriginalTopBarImages:(UIViewController*)viewController {
163
 -(void)storeOriginalTopBarImages:(UIViewController*)viewController {