Bladeren bron

tabBarHidden for iOS (#1753)

Graham Chance 7 jaren geleden
bovenliggende
commit
b4be65a160

+ 1
- 1
README.md Bestand weergeven

@@ -85,7 +85,7 @@ Note:  v1 properties with names beginning with 'navBar' are replaced in v2 with
85 85
 | drawUnderTopBar       |  ✅     |    WIP @gran33     |      [Contribute](CONTRIBUTING.md)       ||
86 86
 | statusBarBlur         |  ✅     |    ✅     |      [Contribute](CONTRIBUTING.md)       | @gtchance|
87 87
 | topBarBlur            | ✅      |    [Contribute](CONTRIBUTING.md)     |      [Contribute](CONTRIBUTING.md)       |
88
-| tabBarHidden  |   ✅  |   [Contribute](CONTRIBUTING.md)     |    [Contribute](CONTRIBUTING.md)        |
88
+| tabBarHidden  |   ✅  |   ✅     |    [Contribute](CONTRIBUTING.md)        | @gtchance|
89 89
 | statusBarTextColorScheme |  ✅   |   in development      |      / iOS specific    |
90 90
 | statusBarTextColorSchemeSingleScreen|  ✅   |     in development    |     / iOS specific      |
91 91
 | navBarSubtitleColor          |  ✅   |   [Contribute](CONTRIBUTING.md)     |      [Contribute](CONTRIBUTING.md)      |

+ 1
- 0
lib/ios/RNNNavigationOptions.h Bestand weergeven

@@ -22,6 +22,7 @@ extern const NSInteger BLUR_STATUS_TAG;
22 22
 @property (nonatomic, strong) NSNumber* topBarNoBorder;
23 23
 @property (nonatomic, strong) NSNumber* statusBarBlur;
24 24
 @property (nonatomic, strong) NSNumber* statusBarHideWithTopBar;
25
+@property (nonatomic, strong) NSNumber* tabBarHidden;
25 26
 
26 27
 -(instancetype)init;
27 28
 -(instancetype)initWithDict:(NSDictionary *)navigationOptions;

+ 1
- 0
lib/ios/RNNNavigationOptions.m Bestand weergeven

@@ -26,6 +26,7 @@ const NSInteger BLUR_STATUS_TAG = 78264801;
26 26
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
27 27
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
28 28
 	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
29
+	self.tabBarHidden = [navigationOptions objectForKey:@"tabBarHidden"];
29 30
 
30 31
 	return self;
31 32
 }

+ 8
- 0
lib/ios/RNNRootViewController.m Bestand weergeven

@@ -49,6 +49,14 @@
49 49
 	return NO;
50 50
 }
51 51
 
52
+- (BOOL)hidesBottomBarWhenPushed
53
+{
54
+	if (self.navigationOptions.tabBarHidden) {
55
+		return [self.navigationOptions.tabBarHidden boolValue];
56
+	}
57
+	return NO;
58
+}
59
+
52 60
 -(void)viewDidAppear:(BOOL)animated {
53 61
 	[super viewDidAppear:animated];
54 62
 	[self.eventEmitter sendContainerDidAppear:self.containerId];

+ 23
- 0
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m Bestand weergeven

@@ -318,5 +318,28 @@
318 318
 	XCTAssertNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
319 319
 }
320 320
 
321
+- (void)testTabBarHidden_default {
322
+	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
323
+	[self.uut viewWillAppear:false];
324
+
325
+	XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
326
+}
327
+
328
+
329
+- (void)testTabBarHidden_true {
330
+	self.options.tabBarHidden = @(1);
331
+	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
332
+	[self.uut viewWillAppear:false];
333
+
334
+	XCTAssertTrue([self.uut hidesBottomBarWhenPushed]);
335
+}
336
+
337
+- (void)testTabBarHidden_false {
338
+	self.options.tabBarHidden = @(0);
339
+	__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
340
+	[self.uut viewWillAppear:false];
341
+
342
+	XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
343
+}
321 344
 
322 345
 @end