Browse Source

Apply extendedLayoutIncludesOpaqueBars true on all viewControllers

yogevbd 4 years ago
parent
commit
9fefeca9be

+ 4
- 0
lib/ios/UIViewController+LayoutProtocol.m View File

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;

+ 10
- 12
lib/ios/UIViewController+RNNOptions.m View File

57
 }
57
 }
58
 
58
 
59
 - (void)setDrawBehindTopBar:(BOOL)drawBehind {
59
 - (void)setDrawBehindTopBar:(BOOL)drawBehind {
60
-    if (drawBehind) {
61
-        [self setExtendedLayoutIncludesOpaqueBars:YES];
62
-        self.edgesForExtendedLayout |= UIRectEdgeTop;
63
-    } else {
64
-        self.edgesForExtendedLayout &= ~UIRectEdgeTop;
65
-    }
60
+	if (drawBehind) {
61
+		self.edgesForExtendedLayout |= UIRectEdgeTop;
62
+	} else {
63
+		self.edgesForExtendedLayout &= ~UIRectEdgeTop;
64
+	}
66
 }
65
 }
67
 
66
 
68
 - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
67
 - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
69
-    if (drawBehindTabBar) {
70
-        [self setExtendedLayoutIncludesOpaqueBars:YES];
71
-        self.edgesForExtendedLayout |= UIRectEdgeBottom;
72
-    } else {
73
-        self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
74
-    }
68
+	if (drawBehindTabBar) {
69
+		self.edgesForExtendedLayout |= UIRectEdgeBottom;
70
+	} else {
71
+		self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
72
+	}
75
 }
73
 }
76
 
74
 
77
 - (void)setTabBarItemBadge:(NSString *)badge {
75
 - (void)setTabBarItemBadge:(NSString *)badge {

+ 10
- 0
playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m View File

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 View File

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];