Browse Source

backButton fixed in ios

yogevbd 6 years ago
parent
commit
2ab7f1b140
2 changed files with 11 additions and 26 deletions
  1. 11
    7
      lib/ios/RNNBackButtonOptions.m
  2. 0
    19
      lib/ios/RNNTopBarOptions.m

+ 11
- 7
lib/ios/RNNBackButtonOptions.m View File

@@ -3,12 +3,18 @@
3 3
 @implementation RNNBackButtonOptions
4 4
 
5 5
 - (void)applyOn:(UIViewController *)viewController {
6
-	UIImage *image = self.image ? [RCTConvert UIImage:self.image] : nil;
7
-	[viewController.navigationController.navigationBar setBackIndicatorImage:image];
8
-	[viewController.navigationController.navigationBar setBackIndicatorTransitionMaskImage:image];
6
+	if (self.image) {
7
+		UIImage *image = self.image ? [RCTConvert UIImage:self.image] : nil;
8
+		[viewController.navigationController.navigationBar setBackIndicatorImage:image];
9
+		[viewController.navigationController.navigationBar setBackIndicatorTransitionMaskImage:image];
10
+	}
9 11
 	
10
-	if ([self.hideTitle boolValue]) {
11
-		self.title = @"";
12
+	if (self.visible) {
13
+		viewController.navigationItem.hidesBackButton = ![self.visible boolValue];
14
+		
15
+		if (![self.visible boolValue]) {
16
+			self.title = @"";
17
+		}
12 18
 	}
13 19
 	
14 20
 	if (self.title) {
@@ -19,8 +25,6 @@
19 25
 		
20 26
 		viewController.navigationItem.backBarButtonItem = backItem;
21 27
 	}
22
-	
23
-	viewController.navigationItem.hidesBackButton = ![self.visible boolValue];
24 28
 }
25 29
 
26 30
 @end

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

@@ -150,25 +150,6 @@ extern const NSInteger BLUR_TOPBAR_TAG;
150 150
 		_navigationButtons = [[RNNNavigationButtons alloc] initWithViewController:(RNNRootViewController*)viewController];
151 151
 		[_navigationButtons applyLeftButtons:self.leftButtons rightButtons:self.rightButtons];
152 152
 	}
153
-
154
-	UIImage *image = self.backButton.image ? [RCTConvert UIImage:self.backButton.image] : nil;
155
-	[viewController.navigationController.navigationBar setBackIndicatorImage:image];
156
-	[viewController.navigationController.navigationBar setBackIndicatorTransitionMaskImage:image];
157
-	
158
-	if (![self.backButton.visible boolValue]) {
159
-		self.backButton.title = @"";
160
-	}
161
-	
162
-	if (self.backButton.title) {
163
-		UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:self.backButton.title
164
-																	 style:UIBarButtonItemStylePlain
165
-																	target:nil
166
-																	action:nil];
167
-		
168
-		viewController.navigationItem.backBarButtonItem = backItem;
169
-	}
170
-	
171
-	viewController.navigationItem.hidesBackButton = ![self.backButton.visible boolValue];
172 153
 }
173 154
 
174 155
 -(void)storeOriginalTopBarImages:(UIViewController*)viewController {