diff --git a/lib/ios/UIViewController+LayoutProtocol.m b/lib/ios/UIViewController+LayoutProtocol.m index b63a8a4c35d..0c25105b77e 100644 --- a/lib/ios/UIViewController+LayoutProtocol.m +++ b/lib/ios/UIViewController+LayoutProtocol.m @@ -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; diff --git a/lib/ios/UIViewController+RNNOptions.m b/lib/ios/UIViewController+RNNOptions.m index 9d1a572b940..f241c60a3b7 100644 --- a/lib/ios/UIViewController+RNNOptions.m +++ b/lib/ios/UIViewController+RNNOptions.m @@ -58,7 +58,6 @@ - (void)setNavigationItemTitle:(NSString *)title { - (void)setDrawBehindTopBar:(BOOL)drawBehind { if (drawBehind) { - [self setExtendedLayoutIncludesOpaqueBars:YES]; self.edgesForExtendedLayout |= UIRectEdgeTop; } else { self.edgesForExtendedLayout &= ~UIRectEdgeTop; @@ -67,7 +66,6 @@ - (void)setDrawBehindTopBar:(BOOL)drawBehind { - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar { if (drawBehindTabBar) { - [self setExtendedLayoutIncludesOpaqueBars:YES]; self.edgesForExtendedLayout |= UIRectEdgeBottom; } else { self.edgesForExtendedLayout &= ~UIRectEdgeBottom; diff --git a/playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m b/playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m index ba3d9bc5f4e..f13b893847d 100644 --- a/playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m +++ b/playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m @@ -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 diff --git a/playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m b/playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m index df5c7f4cac4..69db4ee4a43 100644 --- a/playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m +++ b/playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m @@ -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];