Skip to content

Commit

Permalink
apply extendedLayoutIncludesOpaqueBars true on all viewControllers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd authored Feb 5, 2020
1 parent ffbd288 commit 527fd49
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 4 additions & 0 deletions lib/ios/UIViewController+LayoutProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ - (void)overrideOptions:(RNNNavigationOptions *)options {
[self.options overrideOptions:options];
}

- (BOOL)extendedLayoutIncludesOpaqueBars {
return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
UIInterfaceOrientationMask interfaceOrientationMask = self.presenter ? [self.presenter getOrientation:[self resolveOptions]] : [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
return interfaceOrientationMask;
Expand Down
2 changes: 0 additions & 2 deletions lib/ios/UIViewController+RNNOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ - (void)setNavigationItemTitle:(NSString *)title {

- (void)setDrawBehindTopBar:(BOOL)drawBehind {
if (drawBehind) {
[self setExtendedLayoutIncludesOpaqueBars:YES];
self.edgesForExtendedLayout |= UIRectEdgeTop;
} else {
self.edgesForExtendedLayout &= ~UIRectEdgeTop;
Expand All @@ -67,7 +66,6 @@ - (void)setDrawBehindTopBar:(BOOL)drawBehind {

- (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
if (drawBehindTabBar) {
[self setExtendedLayoutIncludesOpaqueBars:YES];
self.edgesForExtendedLayout |= UIRectEdgeBottom;
} else {
self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,14 @@ - (void)testMergeOptions_mergedIntoCurrentOptions {
XCTAssertEqual(uut.resolveOptions.topBar.title.text.get, @"merged");
}

- (void)testLayout_shouldExtendedLayoutIncludesOpaqueBars {
UIViewController* component = [[UIViewController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:nil];
UINavigationController* stack = [[UINavigationController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:nil];
UITabBarController* tabBar = [[UITabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:nil];

XCTAssertTrue(component.extendedLayoutIncludesOpaqueBars);
XCTAssertTrue(stack.extendedLayoutIncludesOpaqueBars);
XCTAssertTrue(tabBar.extendedLayoutIncludesOpaqueBars);
}

@end
12 changes: 0 additions & 12 deletions playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ - (void)test_setTabBarItemBadge_shouldResetWhenValueIsNullObject {
XCTAssertEqual([self.uut tabBarItem].badgeValue, nil);
}

- (void)testSetDrawBehindTopBarTrue_shouldSetExtendedLayoutTrue {
[[self.uut expect] setExtendedLayoutIncludesOpaqueBars:YES];
[self.uut setDrawBehindTopBar:YES];
[self.uut verify];
}

- (void)testSetDrawBehindTabBarTrue_shouldSetExtendedLayoutTrue {
[[self.uut expect] setExtendedLayoutIncludesOpaqueBars:YES];
[self.uut setDrawBehindTabBar:YES];
[self.uut verify];
}

- (void)testSetDrawBehindTopBarFalse_shouldNotCallExtendedLayout {
[[self.uut reject] setExtendedLayoutIncludesOpaqueBars:NO];
[self.uut setDrawBehindTopBar:NO];
Expand Down

0 comments on commit 527fd49

Please sign in to comment.