浏览代码

apply extendedLayoutIncludesOpaqueBars true on all viewControllers (#5906)

Yogev Ben David 5 年前
父节点
当前提交
527fd49f2f
没有帐户链接到提交者的电子邮件

+ 4
- 0
lib/ios/UIViewController+LayoutProtocol.m 查看文件

51
 	[self.options overrideOptions:options];
51
 	[self.options overrideOptions:options];
52
 }
52
 }
53
 
53
 
54
+- (BOOL)extendedLayoutIncludesOpaqueBars {
55
+    return YES;
56
+}
57
+
54
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
58
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
55
 	UIInterfaceOrientationMask interfaceOrientationMask = self.presenter ? [self.presenter getOrientation:[self resolveOptions]] : [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
59
 	UIInterfaceOrientationMask interfaceOrientationMask = self.presenter ? [self.presenter getOrientation:[self resolveOptions]] : [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
56
 	return interfaceOrientationMask;
60
 	return interfaceOrientationMask;

+ 0
- 2
lib/ios/UIViewController+RNNOptions.m 查看文件

58
 
58
 
59
 - (void)setDrawBehindTopBar:(BOOL)drawBehind {
59
 - (void)setDrawBehindTopBar:(BOOL)drawBehind {
60
 	if (drawBehind) {
60
 	if (drawBehind) {
61
-		[self setExtendedLayoutIncludesOpaqueBars:YES];
62
 		self.edgesForExtendedLayout |= UIRectEdgeTop;
61
 		self.edgesForExtendedLayout |= UIRectEdgeTop;
63
 	} else {
62
 	} else {
64
 		self.edgesForExtendedLayout &= ~UIRectEdgeTop;
63
 		self.edgesForExtendedLayout &= ~UIRectEdgeTop;
67
 
66
 
68
 - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
67
 - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
69
 	if (drawBehindTabBar) {
68
 	if (drawBehindTabBar) {
70
-		[self setExtendedLayoutIncludesOpaqueBars:YES];
71
 		self.edgesForExtendedLayout |= UIRectEdgeBottom;
69
 		self.edgesForExtendedLayout |= UIRectEdgeBottom;
72
 	} else {
70
 	} else {
73
 		self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
71
 		self.edgesForExtendedLayout &= ~UIRectEdgeBottom;

+ 10
- 0
playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m 查看文件

108
 	XCTAssertEqual(uut.resolveOptions.topBar.title.text.get, @"merged");
108
 	XCTAssertEqual(uut.resolveOptions.topBar.title.text.get, @"merged");
109
 }
109
 }
110
 
110
 
111
+- (void)testLayout_shouldExtendedLayoutIncludesOpaqueBars {
112
+	UIViewController* component = [[UIViewController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:nil];
113
+	UINavigationController* stack = [[UINavigationController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:nil];
114
+	UITabBarController* tabBar = [[UITabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:nil];
115
+	
116
+	XCTAssertTrue(component.extendedLayoutIncludesOpaqueBars);
117
+	XCTAssertTrue(stack.extendedLayoutIncludesOpaqueBars);
118
+	XCTAssertTrue(tabBar.extendedLayoutIncludesOpaqueBars);
119
+}
120
+
111
 @end
121
 @end

+ 0
- 12
playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m 查看文件

34
     XCTAssertEqual([self.uut tabBarItem].badgeValue, nil);
34
     XCTAssertEqual([self.uut tabBarItem].badgeValue, nil);
35
 }
35
 }
36
 
36
 
37
-- (void)testSetDrawBehindTopBarTrue_shouldSetExtendedLayoutTrue {
38
-    [[self.uut expect] setExtendedLayoutIncludesOpaqueBars:YES];
39
-    [self.uut setDrawBehindTopBar:YES];
40
-    [self.uut verify];
41
-}
42
-
43
-- (void)testSetDrawBehindTabBarTrue_shouldSetExtendedLayoutTrue {
44
-    [[self.uut expect] setExtendedLayoutIncludesOpaqueBars:YES];
45
-    [self.uut setDrawBehindTabBar:YES];
46
-    [self.uut verify];
47
-}
48
-
49
 - (void)testSetDrawBehindTopBarFalse_shouldNotCallExtendedLayout {
37
 - (void)testSetDrawBehindTopBarFalse_shouldNotCallExtendedLayout {
50
     [[self.uut reject] setExtendedLayoutIncludesOpaqueBars:NO];
38
     [[self.uut reject] setExtendedLayoutIncludesOpaqueBars:NO];
51
     [self.uut setDrawBehindTopBar:NO];
39
     [self.uut setDrawBehindTopBar:NO];