Browse Source

statusBar.hidden changed to statusBar.visible in iOS

yogevbd 6 years ago
parent
commit
7d9ba7292b

+ 1
- 1
docs/docs/layout-types.md View File

@@ -184,7 +184,7 @@ Navigation.setRoot({
184 184
     stack: {
185 185
       options: {
186 186
         topBar: {
187
-          hidden: true
187
+          visible: false
188 188
         }
189 189
       },
190 190
       children: [

+ 2
- 2
lib/ios/RNNRootViewController.m View File

@@ -194,8 +194,8 @@
194 194
 }
195 195
 
196 196
 - (BOOL)prefersStatusBarHidden {
197
-	if ([self.options.statusBar.hidden boolValue]) {
198
-		return YES;
197
+	if (self.options.statusBar.visible) {
198
+		return ![self.options.statusBar.visible boolValue];
199 199
 	} else if ([self.options.statusBar.hideWithTopBar boolValue]) {
200 200
 		return self.navigationController.isNavigationBarHidden;
201 201
 	}

+ 1
- 1
lib/ios/RNNStatusBarOptions.h View File

@@ -7,7 +7,7 @@ extern const NSInteger BLUR_STATUS_TAG;
7 7
 @property (nonatomic, strong) NSNumber* blur;
8 8
 @property (nonatomic, strong) NSNumber* hideWithTopBar;
9 9
 @property (nonatomic, strong) NSString* style;
10
-@property (nonatomic, strong) NSNumber* hidden;
10
+@property (nonatomic, strong) NSNumber* visible;
11 11
 @property (nonatomic, strong) NSNumber* animate;
12 12
 
13 13
 @end

+ 1
- 1
lib/ios/RNNStatusBarOptions.m View File

@@ -20,7 +20,7 @@
20 20
 		}
21 21
 	}
22 22
 	
23
-	if (self.style || self.hidden) {
23
+	if (self.style || self.visible) {
24 24
 		[UIView animateWithDuration:[self statusBarAnimationDuration] animations:^{
25 25
 			[viewController setNeedsStatusBarAppearanceUpdate];
26 26
 		}];

+ 10
- 11
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

@@ -69,14 +69,22 @@
69 69
 	XCTAssertFalse([self.uut prefersStatusBarHidden]);
70 70
 }
71 71
 
72
-- (void)testStatusBarHidden_true {
73
-	self.options.statusBar.hidden = @(1);
72
+- (void)testStatusBarVisible_false {
73
+	self.options.statusBar.visible = @(0);
74 74
 	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
75 75
 	[self.uut viewWillAppear:false];
76 76
 
77 77
 	XCTAssertTrue([self.uut prefersStatusBarHidden]);
78 78
 }
79 79
 
80
+- (void)testStatusBarVisible_true {
81
+	self.options.statusBar.visible = @(1);
82
+	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
83
+	[self.uut viewWillAppear:false];
84
+	
85
+	XCTAssertFalse([self.uut prefersStatusBarHidden]);
86
+}
87
+
80 88
 - (void)testStatusBarHideWithTopBar_false {
81 89
 	self.options.statusBar.hideWithTopBar = @(0);
82 90
 	self.options.topBar.visible = @(0);
@@ -95,15 +103,6 @@
95 103
 	XCTAssertTrue([self.uut prefersStatusBarHidden]);
96 104
 }
97 105
 
98
-
99
-- (void)testStatusBarHidden_false {
100
-	self.options.statusBar.hidden = @(0);
101
-	__unused RNNNavigationController* nav = [[RNNNavigationController alloc] initWithRootViewController:self.uut];
102
-	[self.uut viewWillAppear:false];
103
-
104
-	XCTAssertFalse([self.uut prefersStatusBarHidden]);
105
-}
106
-
107 106
 -(void)testTitle_string{
108 107
 	NSString* title =@"some title";
109 108
 	self.options.topBar.title.text = title;