Kaynağa Gözat

Improve getCurrentlyVisibleScreenId on iOS with drawers. (#2052)

Royce Townsend 7 yıl önce
ebeveyn
işleme
2c30a52bb9
2 değiştirilmiş dosya ile 9 ekleme ve 1 silme
  1. 8
    0
      ios/RCCManagerModule.m
  2. 1
    1
      ios/RCCNavigationController.m

+ 8
- 0
ios/RCCManagerModule.m Dosyayı Görüntüle

@@ -377,6 +377,14 @@ RCT_EXPORT_METHOD(
377 377
     {
378 378
         return [self getVisibleViewControllerFor:vc.presentedViewController];
379 379
     }
380
+    else if ([vc isKindOfClass:[TheSidebarController class]]) {
381
+        TheSidebarController *drawerController = (TheSidebarController*) vc;
382
+        return [self getVisibleViewControllerFor:drawerController.contentViewController];
383
+    }
384
+    else if ([vc isKindOfClass:[MMDrawerController class]]) {
385
+        MMDrawerController *drawerController = (MMDrawerController*) vc;
386
+        return [self getVisibleViewControllerFor:drawerController.centerViewController];
387
+    }
380 388
     else
381 389
     {
382 390
         return vc;

+ 1
- 1
ios/RCCNavigationController.m Dosyayı Görüntüle

@@ -41,7 +41,7 @@ NSString const *CALLBACK_ASSOCIATED_ID = @"RCCNavigationController.CALLBACK_ASSO
41 41
   
42 42
   RCCViewController *viewController = [[RCCViewController alloc] initWithComponent:component passProps:passProps navigatorStyle:navigatorStyle globalProps:globalProps bridge:bridge];
43 43
   if (!viewController) return nil;
44
-  viewController.controllerId = props[@"id"];
44
+  viewController.controllerId = passProps[@"screenInstanceID"];
45 45
   
46 46
   NSArray *leftButtons = props[@"leftButtons"];
47 47
   if (leftButtons)