Selaa lähdekoodia

Fixes for dynamically controlling iOS drawer status (#1356)

* Fix iOS drawer status control

* Prevent MMDrawerController disabling UI interaction when accidentally assigning a nil drawer controller and toggling that drawer
Matt Davies 7 vuotta sitten
vanhempi
commit
35c61b450f

+ 6
- 5
ios/RCCDrawerController/MMDrawerController/MMDrawerController.m Näytä tiedosto

@@ -369,13 +369,14 @@ static NSString *MMDrawerOpenSideKey = @"MMDrawerOpenSide";
369 369
         }
370 370
     }
371 371
     else {
372
-        [self setAnimatingDrawer:animated];
373 372
         UIViewController * sideDrawerViewController = [self sideDrawerViewControllerForSide:drawerSide];
374
-        if (self.openSide != drawerSide) {
375
-            [self prepareToPresentDrawer:drawerSide animated:animated];
376
-        }
377
-        
373
+
378 374
         if(sideDrawerViewController){
375
+            [self setAnimatingDrawer:animated];
376
+            if (self.openSide != drawerSide) {
377
+                [self prepareToPresentDrawer:drawerSide animated:animated];
378
+            }
379
+            
379 380
             CGRect newFrame;
380 381
             CGRect oldFrame = self.centerContainerView.frame;
381 382
             if(drawerSide == MMDrawerSideLeft){

+ 1
- 3
ios/RCCDrawerController/RCCDrawerController.m Näytä tiedosto

@@ -30,13 +30,11 @@ UIViewController *rightViewController = nil;
30 30
     UIViewController *centerViewController = [RCCViewController controllerWithLayout:children[0] globalProps:globalProps bridge:bridge];
31 31
     
32 32
     // left
33
-    UIViewController *leftViewController = nil;
34 33
     NSString *componentLeft = props[@"componentLeft"];
35 34
     NSDictionary *passPropsLeft = props[@"passPropsLeft"];
36 35
     if (componentLeft) leftViewController = [[RCCViewController alloc] initWithComponent:componentLeft passProps:passPropsLeft navigatorStyle:nil globalProps:globalProps bridge:bridge];
37 36
     
38 37
     // right
39
-    UIViewController *rightViewController = nil;
40 38
     NSString *componentRight = props[@"componentRight"];
41 39
     NSDictionary *passPropsRight = props[@"passPropsRight"];
42 40
     if (componentRight) rightViewController = [[RCCViewController alloc] initWithComponent:componentRight passProps:passPropsRight navigatorStyle:nil globalProps:globalProps bridge:bridge];
@@ -133,7 +131,7 @@ UIViewController *rightViewController = nil;
133 131
     {
134 132
         bool enabled = [actionParams[@"enabled"] boolValue];
135 133
         if ([actionParams[@"side"] isEqualToString:@"left"]) {
136
-            [super setLeftDrawerViewController: enabled ? rightViewController : nil];
134
+            [super setLeftDrawerViewController: enabled ? leftViewController : nil];
137 135
         } else if ([actionParams[@"side"] isEqualToString:@"right"]) {
138 136
             [super setRightDrawerViewController: enabled ? rightViewController : nil];
139 137
         }