浏览代码

backButtonTitle support

yogevbd 7 年前
父节点
当前提交
904f02a8ae
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 1
    0
      lib/ios/RNNTopBarOptions.h
  2. 9
    0
      lib/ios/RNNTopBarOptions.m

+ 1
- 0
lib/ios/RNNTopBarOptions.h 查看文件

@@ -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 查看文件

@@ -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 {