Browse Source

Fix bottomTabs visible false wrong layout (#6095)

* Use viewController hidesBottomBarWhenPushed method for bottomTabs visibility
Yogev Ben David 4 years ago
parent
commit
21cafcdecc
No account linked to committer's email address

+ 0
- 1
lib/ios/BottomTabsBasePresenter.m View File

17
     RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
17
     RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
18
 
18
 
19
     [bottomTabs setTabBarTestID:[withDefault.bottomTabs.testID getWithDefaultValue:nil]];
19
     [bottomTabs setTabBarTestID:[withDefault.bottomTabs.testID getWithDefaultValue:nil]];
20
-    [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible getWithDefaultValue:YES] animated:[withDefault.bottomTabs.animate getWithDefaultValue:NO]];
21
     
20
     
22
     [bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
21
     [bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
23
     [self applyBackgroundColor:[withDefault.bottomTabs.backgroundColor getWithDefaultValue:nil] translucent:[withDefault.bottomTabs.translucent getWithDefaultValue:NO]];
22
     [self applyBackgroundColor:[withDefault.bottomTabs.backgroundColor getWithDefaultValue:nil] translucent:[withDefault.bottomTabs.translucent getWithDefaultValue:NO]];

+ 2
- 0
lib/ios/RNNBasePresenter.h View File

47
 
47
 
48
 - (BOOL)getStatusBarVisibility;
48
 - (BOOL)getStatusBarVisibility;
49
 
49
 
50
+- (BOOL)hidesBottomBarWhenPushed;
51
+
50
 @end
52
 @end

+ 4
- 0
lib/ios/RNNBasePresenter.m View File

119
     return NO;
119
     return NO;
120
 }
120
 }
121
 
121
 
122
+- (BOOL)hidesBottomBarWhenPushed {
123
+    RNNNavigationOptions *withDefault = [self.boundViewController.topMostViewController.resolveOptions withDefault:self.defaultOptions];
124
+    return ![withDefault.bottomTabs.visible getWithDefaultValue:YES];
125
+}
122
 
126
 
123
 @end
127
 @end

+ 4
- 0
lib/ios/RNNBottomTabsController.m View File

131
     return [self.presenter getOrientation];
131
     return [self.presenter getOrientation];
132
 }
132
 }
133
 
133
 
134
+- (BOOL)hidesBottomBarWhenPushed {
135
+    return [self.presenter hidesBottomBarWhenPushed];
136
+}
137
+
134
 
138
 
135
 @end
139
 @end

+ 3
- 0
lib/ios/RNNComponentViewController.m View File

148
     return [self.presenter getOrientation];
148
     return [self.presenter getOrientation];
149
 }
149
 }
150
 
150
 
151
+- (BOOL)hidesBottomBarWhenPushed {
152
+    return [self.presenter hidesBottomBarWhenPushed];
153
+}
151
 
154
 
152
 @end
155
 @end

+ 4
- 0
lib/ios/RNNExternalViewController.m View File

48
     return [self.presenter getOrientation];
48
     return [self.presenter getOrientation];
49
 }
49
 }
50
 
50
 
51
+- (BOOL)hidesBottomBarWhenPushed {
52
+    return [self.presenter hidesBottomBarWhenPushed];
53
+}
54
+
51
 @end
55
 @end

+ 4
- 0
lib/ios/RNNSideMenuChildVC.m View File

57
     return [self.presenter getOrientation];
57
     return [self.presenter getOrientation];
58
 }
58
 }
59
 
59
 
60
+- (BOOL)hidesBottomBarWhenPushed {
61
+    return [self.presenter hidesBottomBarWhenPushed];
62
+}
63
+
60
 @end
64
 @end

+ 4
- 0
lib/ios/RNNSideMenuController.m View File

173
     return [self.presenter getOrientation];
173
     return [self.presenter getOrientation];
174
 }
174
 }
175
 
175
 
176
+- (BOOL)hidesBottomBarWhenPushed {
177
+    return [self.presenter hidesBottomBarWhenPushed];
178
+}
179
+
176
 @end
180
 @end

+ 4
- 0
lib/ios/RNNSplitViewController.m View File

31
     return [self.presenter getOrientation];
31
     return [self.presenter getOrientation];
32
 }
32
 }
33
 
33
 
34
+- (BOOL)hidesBottomBarWhenPushed {
35
+    return [self.presenter hidesBottomBarWhenPushed];
36
+}
37
+
34
 @end
38
 @end

+ 4
- 0
lib/ios/RNNStackController.m View File

72
     return [self.presenter getOrientation];
72
     return [self.presenter getOrientation];
73
 }
73
 }
74
 
74
 
75
+- (BOOL)hidesBottomBarWhenPushed {
76
+    return [self.presenter hidesBottomBarWhenPushed];
77
+}
78
+
75
 @end
79
 @end

+ 0
- 2
playground/ios/NavigationIOS12Tests/RNNBottomTabsPresenterTest.m View File

28
 	[[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
28
 	[[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
29
     [[self.boundViewController expect] setTabBarHideShadow:NO];
29
     [[self.boundViewController expect] setTabBarHideShadow:NO];
30
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
30
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
31
-    [[self.boundViewController expect] setTabBarVisible:YES animated:NO];
32
     [self.uut applyOptions:emptyOptions];
31
     [self.uut applyOptions:emptyOptions];
33
     [self.boundViewController verify];
32
     [self.boundViewController verify];
34
 }
33
 }
46
     [[(id)self.uut expect] applyBackgroundColor:nil translucent:[UIColor redColor]];
45
     [[(id)self.uut expect] applyBackgroundColor:nil translucent:[UIColor redColor]];
47
     [[self.boundViewController expect] setTabBarHideShadow:YES];
46
     [[self.boundViewController expect] setTabBarHideShadow:YES];
48
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleBlack];
47
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleBlack];
49
-    [[self.boundViewController expect] setTabBarVisible:NO animated:NO];
50
 
48
 
51
     [self.uut applyOptions:initialOptions];
49
     [self.uut applyOptions:initialOptions];
52
     [self.boundViewController verify];
50
     [self.boundViewController verify];

+ 39
- 0
playground/ios/NavigationTests/RNNBasePresenterTest.m View File

84
 	XCTAssertTrue(_boundViewController.modalInPresentation);
84
 	XCTAssertTrue(_boundViewController.modalInPresentation);
85
 }
85
 }
86
 
86
 
87
+- (void)testHidesBottomBarWhenPushed_showsBar {
88
+	_boundViewController.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:NO];
89
+	XCTAssertTrue(_boundViewController.hidesBottomBarWhenPushed);
90
+}
91
+
92
+- (void)testHidesBottomBarWhenPushed_hidesBar {
93
+	_boundViewController.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:YES];
94
+	XCTAssertFalse(_boundViewController.hidesBottomBarWhenPushed);
95
+}
96
+
97
+- (void)testHidesBottomBarWhenPushed_resolveParentShowsBar {
98
+	UINavigationController* nvc = [[UINavigationController alloc] initWithRootViewController:self.boundViewController];
99
+	nvc.options = [RNNNavigationOptions emptyOptions];
100
+	nvc.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:NO];
101
+	XCTAssertTrue(_boundViewController.hidesBottomBarWhenPushed);
102
+}
103
+
104
+- (void)testHidesBottomBarWhenPushed_resolveParentHidesBar {
105
+	UINavigationController* nvc = [[UINavigationController alloc] initWithRootViewController:self.boundViewController];
106
+	nvc.options = [RNNNavigationOptions emptyOptions];
107
+	nvc.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:YES];
108
+	XCTAssertFalse(_boundViewController.hidesBottomBarWhenPushed);
109
+}
110
+
111
+- (void)testHidesBottomBarWhenPushed_resolveChildShowsBarBeforeParent {
112
+	UINavigationController* nvc = [[UINavigationController alloc] initWithRootViewController:self.boundViewController];
113
+	nvc.options = [RNNNavigationOptions emptyOptions];
114
+	nvc.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:NO];
115
+	XCTAssertTrue(_boundViewController.hidesBottomBarWhenPushed);
116
+}
117
+
118
+- (void)testHidesBottomBarWhenPushed_resolveChildHidesBarBeforeParent {
119
+	UINavigationController* nvc = [[UINavigationController alloc] initWithRootViewController:self.boundViewController];
120
+	nvc.options = [RNNNavigationOptions emptyOptions];
121
+	self.boundViewController.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:NO];
122
+	nvc.options.bottomTabs.visible = [[Bool alloc] initWithBOOL:YES];
123
+	XCTAssertTrue(_boundViewController.hidesBottomBarWhenPushed);
124
+}
125
+
87
 @end
126
 @end

+ 0
- 2
playground/ios/NavigationTests/RNNBottomTabsAppearancePresenterTest.m View File

36
     [[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
36
     [[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
37
     [[self.boundViewController expect] setTabBarHideShadow:NO];
37
     [[self.boundViewController expect] setTabBarHideShadow:NO];
38
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
38
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
39
-    [[self.boundViewController expect] setTabBarVisible:YES animated:NO];
40
     [self.uut applyOptions:emptyOptions];
39
     [self.uut applyOptions:emptyOptions];
41
     [self.boundViewController verify];
40
     [self.boundViewController verify];
42
 }
41
 }
54
     [[(id)self.uut expect] applyBackgroundColor:nil translucent:[UIColor redColor]];
53
     [[(id)self.uut expect] applyBackgroundColor:nil translucent:[UIColor redColor]];
55
     [[self.boundViewController expect] setTabBarHideShadow:YES];
54
     [[self.boundViewController expect] setTabBarHideShadow:YES];
56
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleBlack];
55
     [[self.boundViewController expect] setTabBarStyle:UIBarStyleBlack];
57
-    [[self.boundViewController expect] setTabBarVisible:NO animated:NO];
58
 
56
 
59
     [self.uut applyOptions:initialOptions];
57
     [self.uut applyOptions:initialOptions];
60
     [self.boundViewController verify];
58
     [self.boundViewController verify];