Procházet zdrojové kódy

Fix bottomTabs attach mode for sideMenu (#6001)

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David před 4 roky
rodič
revize
7d6029f06b
No account linked to committer's email address

+ 5
- 5
lib/ios/RNNSideMenuChildVC.m Zobrazit soubor

@@ -18,15 +18,15 @@
18 18
 }
19 19
 
20 20
 - (void)render {
21
-	[self.getCurrentChild render];
21
+    [self addChildViewController:self.child];
22
+    [self.child.view setFrame:self.view.bounds];
23
+    [self.view addSubview:self.child.view];
24
+    [self.view bringSubviewToFront:self.child.view];
25
+    [self.child render];
22 26
 }
23 27
 
24 28
 - (void)setChild:(UIViewController<RNNLayoutProtocol> *)child {
25 29
 	_child = child;
26
-	[self addChildViewController:self.child];
27
-	[self.child.view setFrame:self.view.bounds];
28
-	[self.view addSubview:self.child.view];
29
-	[self.view bringSubviewToFront:self.child.view];
30 30
 }
31 31
 
32 32
 - (void)setWidth:(CGFloat)width {

+ 15
- 1
lib/ios/RNNSideMenuController.m Zobrazit soubor

@@ -13,7 +13,7 @@
13 13
 
14 14
 - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo creator:(id<RNNComponentViewCreator>)creator childViewControllers:(NSArray *)childViewControllers options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions presenter:(RNNBasePresenter *)presenter eventEmitter:(RNNEventEmitter *)eventEmitter {
15 15
 	[self setControllers:childViewControllers];
16
-	self = [super initWithCenterViewController:self.center leftDrawerViewController:self.left rightDrawerViewController:self.right];
16
+	self = [super init];
17 17
 	
18 18
 	self.presenter = presenter;
19 19
     [self.presenter bindViewController:self];
@@ -38,6 +38,20 @@
38 38
 	[self.presenter setDefaultOptions:defaultOptions];
39 39
 }
40 40
 
41
+- (void)loadView {
42
+    [super loadView];
43
+    [self setCenterViewController:self.center];
44
+    [self setLeftDrawerViewController:self.left];
45
+    [self setRightDrawerViewController:self.right];
46
+}
47
+
48
+- (void)render {
49
+    [super render];
50
+    [self.center render];
51
+    [self.left render];
52
+    [self.right render];
53
+}
54
+
41 55
 - (void)setAnimationType:(NSString *)animationType {
42 56
 	MMDrawerControllerDrawerVisualStateBlock animationTypeStateBlock = nil;
43 57
 	if ([animationType isEqualToString:@"door"]) animationTypeStateBlock = [MMDrawerVisualState swingingDoorVisualStateBlock];

+ 2
- 2
lib/ios/UIViewController+LayoutProtocol.m Zobrazit soubor

@@ -77,13 +77,13 @@
77 77
         [self readyForPresentation];
78 78
     }
79 79
     
80
-    [self.presentedComponentViewController setReactViewReadyCallback:^{
80
+    [self.getCurrentChild setReactViewReadyCallback:^{
81 81
         [self.presenter renderComponents:self.resolveOptionsWithDefault perform:^{
82 82
             [self readyForPresentation];
83 83
         }];
84 84
     }];
85 85
     
86
-    [self.presentedComponentViewController render];
86
+    [self.getCurrentChild render];
87 87
 }
88 88
 
89 89
 - (void)readyForPresentation {

+ 5
- 1
playground/ios/NavigationTests/RNNSideMenuPresenterTest.m Zobrazit soubor

@@ -16,11 +16,15 @@
16 16
 - (void)setUp {
17 17
     [super setUp];
18 18
 	self.uut = [[RNNSideMenuPresenter alloc] init];
19
-	self.boundViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
19
+	self.boundViewController = [OCMockObject partialMockForObject:[[RNNSideMenuController alloc] initWithLayoutInfo:nil creator:nil childViewControllers:@[[self createChildVC:RNNSideMenuChildTypeCenter]] options:nil defaultOptions:nil presenter:nil eventEmitter:nil]];
20 20
     [self.uut bindViewController:self.boundViewController];
21 21
 	self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
22 22
 }
23 23
 
24
+- (RNNSideMenuChildVC *)createChildVC:(RNNSideMenuChildType)type {
25
+	return [[RNNSideMenuChildVC alloc] initWithLayoutInfo:nil creator:nil options:nil defaultOptions:nil presenter:nil eventEmitter:nil childViewController:[UIViewController new] type:type];
26
+}
27
+
24 28
 - (void)testApplyOptionsShouldSetDefaultValues {
25 29
 	[[self.boundViewController expect] side:MMDrawerSideLeft enabled:YES];
26 30
 	[[self.boundViewController expect] side:MMDrawerSideRight enabled:YES];