Browse Source

tabBarHidden for iOS (#1753)

Graham Chance 7 years ago
parent
commit
b4be65a160

+ 1
- 1
README.md View File

85
 | drawUnderTopBar       |  ✅     |    WIP @gran33     |      [Contribute](CONTRIBUTING.md)       ||
85
 | drawUnderTopBar       |  ✅     |    WIP @gran33     |      [Contribute](CONTRIBUTING.md)       ||
86
 | statusBarBlur         |  ✅     |    ✅     |      [Contribute](CONTRIBUTING.md)       | @gtchance|
86
 | statusBarBlur         |  ✅     |    ✅     |      [Contribute](CONTRIBUTING.md)       | @gtchance|
87
 | topBarBlur            | ✅      |    [Contribute](CONTRIBUTING.md)     |      [Contribute](CONTRIBUTING.md)       |
87
 | topBarBlur            | ✅      |    [Contribute](CONTRIBUTING.md)     |      [Contribute](CONTRIBUTING.md)       |
88
-| tabBarHidden  |   ✅  |   [Contribute](CONTRIBUTING.md)     |    [Contribute](CONTRIBUTING.md)        |
88
+| tabBarHidden  |   ✅  |   ✅     |    [Contribute](CONTRIBUTING.md)        | @gtchance|
89
 | statusBarTextColorScheme |  ✅   |   in development      |      / iOS specific    |
89
 | statusBarTextColorScheme |  ✅   |   in development      |      / iOS specific    |
90
 | statusBarTextColorSchemeSingleScreen|  ✅   |     in development    |     / iOS specific      |
90
 | statusBarTextColorSchemeSingleScreen|  ✅   |     in development    |     / iOS specific      |
91
 | navBarSubtitleColor          |  ✅   |   [Contribute](CONTRIBUTING.md)     |      [Contribute](CONTRIBUTING.md)      |
91
 | navBarSubtitleColor          |  ✅   |   [Contribute](CONTRIBUTING.md)     |      [Contribute](CONTRIBUTING.md)      |

+ 1
- 0
lib/ios/RNNNavigationOptions.h View File

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

+ 1
- 0
lib/ios/RNNNavigationOptions.m View File

26
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
26
 	self.leftButtons = [navigationOptions objectForKey:@"leftButtons"];
27
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
27
 	self.rightButtons = [navigationOptions objectForKey:@"rightButtons"];
28
 	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
28
 	self.topBarNoBorder = [navigationOptions objectForKey:@"topBarNoBorder"];
29
+	self.tabBarHidden = [navigationOptions objectForKey:@"tabBarHidden"];
29
 
30
 
30
 	return self;
31
 	return self;
31
 }
32
 }

+ 8
- 0
lib/ios/RNNRootViewController.m View File

49
 	return NO;
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
 -(void)viewDidAppear:(BOOL)animated {
60
 -(void)viewDidAppear:(BOOL)animated {
53
 	[super viewDidAppear:animated];
61
 	[super viewDidAppear:animated];
54
 	[self.eventEmitter sendContainerDidAppear:self.containerId];
62
 	[self.eventEmitter sendContainerDidAppear:self.containerId];

+ 23
- 0
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

318
 	XCTAssertNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
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
 @end
345
 @end