Kaynağa Gözat

V2 top bar no border (#1688)

* topBarNoBorder for ios

* Unit tests for topBarNoBorder
Graham Chance 7 yıl önce
ebeveyn
işleme
b2105f2347

+ 1
- 1
lib/ios/RNNNavigationOptions.h Dosyayı Görüntüle

15
 @property (nonatomic, strong) NSNumber* topBarTranslucent;
15
 @property (nonatomic, strong) NSNumber* topBarTranslucent;
16
 @property (nonatomic, strong) NSString* tabBadge;
16
 @property (nonatomic, strong) NSString* tabBadge;
17
 @property (nonatomic, strong) NSNumber* topBarTextFontSize;
17
 @property (nonatomic, strong) NSNumber* topBarTextFontSize;
18
-
18
+@property (nonatomic, strong) NSNumber* topBarNoBorder;
19
 
19
 
20
 
20
 
21
 
21
 

+ 12
- 1
lib/ios/RNNNavigationOptions.m Dosyayı Görüntüle

22
 	self.topBarTranslucent = [navigationOptions objectForKey:@"topBarTranslucent"];
22
 	self.topBarTranslucent = [navigationOptions objectForKey:@"topBarTranslucent"];
23
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
23
 	self.tabBadge = [navigationOptions objectForKey:@"tabBadge"];
24
 	self.topBarTextFontSize = [navigationOptions objectForKey:@"topBarTextFontSize"];
24
 	self.topBarTextFontSize = [navigationOptions objectForKey:@"topBarTextFontSize"];
25
-  
25
+	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
26
+
26
 	return self;
27
 	return self;
27
 }
28
 }
28
 
29
 
107
 		}		
108
 		}		
108
 	}
109
 	}
109
 
110
 
111
+	if (self.topBarNoBorder) {
112
+		if ([self.topBarNoBorder boolValue]) {
113
+			viewController.navigationController.navigationBar
114
+			.shadowImage = [[UIImage alloc] init];
115
+		} else {
116
+			viewController.navigationController.navigationBar
117
+			.shadowImage = nil;
118
+		}
119
+	}
120
+
110
 }
121
 }
111
 @end
122
 @end

+ 16
- 0
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m Dosyayı Görüntüle

205
 	//	XCTAssertThrows([self.uut viewWillAppear:false]);
205
 	//	XCTAssertThrows([self.uut viewWillAppear:false]);
206
 }
206
 }
207
 
207
 
208
+-(void)testTopBarNoBorderOn {
209
+	NSNumber* topBarNoBorderInput = @(1);
210
+	self.options.topBarNoBorder = topBarNoBorderInput;
211
+	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
212
+	[self.uut viewWillAppear:false];
213
+	XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
214
+}
215
+
216
+-(void)testTopBarNoBorderOff {
217
+	NSNumber* topBarNoBorderInput = @(0);
218
+	self.options.topBarNoBorder = topBarNoBorderInput;
219
+	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
220
+	[self.uut viewWillAppear:false];
221
+	XCTAssertNil(self.uut.navigationController.navigationBar.shadowImage);
222
+}
223
+
208
 @end
224
 @end