Sfoglia il codice sorgente

Improve getCurrentlyVisibleScreenId on iOS with drawers. (#2052)

Royce Townsend 6 anni fa
parent
commit
2c30a52bb9
2 ha cambiato i file con 9 aggiunte e 1 eliminazioni
  1. 8
    0
      ios/RCCManagerModule.m
  2. 1
    1
      ios/RCCNavigationController.m

+ 8
- 0
ios/RCCManagerModule.m Vedi File

@@ -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 Vedi File

@@ -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)