Przeglądaj źródła

Apply extendedLayoutIncludesOpaqueBars true on all viewControllers

yogevbd 4 lat temu
rodzic
commit
9fefeca9be

+ 4
- 0
lib/ios/UIViewController+LayoutProtocol.m Wyświetl plik

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

+ 10
- 12
lib/ios/UIViewController+RNNOptions.m Wyświetl plik

@@ -57,21 +57,19 @@ const NSInteger BLUR_STATUS_TAG = 78264801;
57 57
 }
58 58
 
59 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 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 75
 - (void)setTabBarItemBadge:(NSString *)badge {

+ 10
- 0
playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.m Wyświetl plik

@@ -108,4 +108,14 @@
108 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 121
 @end

+ 0
- 12
playground/ios/NavigationTests/UIViewController+RNNOptionsTest.m Wyświetl plik

@@ -34,18 +34,6 @@
34 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 37
 //- (void)testSetDrawBehindTopBarFalse_shouldNotCallExtendedLayout {
50 38
 //    [[self.uut reject] setExtendedLayoutIncludesOpaqueBars:NO];
51 39
 //    [self.uut setDrawBehindTopBar:NO];